Sign in to follow this  
Followers 0
masakari098

grepp'in till the mornin' come

9 posts in this topic

how do you grep something (or run any command for that matter) and pipe it into a file? :umph: (currently reading up on data pipes, so dont just tell me to google it, please)

Edited by masakari098
0

Share this post


Link to post
Share on other sites

file.txt:

ls -lk

test.sh:

#!/bin/bash

$(cat file.txt) | grep pr0n > pr0n.list

0

Share this post


Link to post
Share on other sites

yep, was just about to post that i found the answer, but that does it. thanks :voteyes:

0

Share this post


Link to post
Share on other sites

ok, new question: how do I filter strings out of text? specifically, I have a bunch of colons in the output file from a ping sweep I did, and nmap sees them as errors when i try to feed the file into it using the -iL switch.

edit: found the "replace" command.....problem solved

Edited by masakari098
0

Share this post


Link to post
Share on other sites

Type 'man grep' for a nice tutorial on how to use it.

In fact the 'man [whatever]' trick work's for allot of things.

0

Share this post


Link to post
Share on other sites

To grep you have to be in the command shell in the directory they exe is in and then run

the command grep -i "the filed you are looking for" the file name >> then the file name you want to pipe it to the arrows are what tells it it to pipe. the -i tell the grep to ignore caps hope this helps

0

Share this post


Link to post
Share on other sites

As said before just check out the help subjects for grep in your dristro. Usually they're pretty informative. Gotta love *nix for that.

0

Share this post


Link to post
Share on other sites

sed can also be pretty usefull for filtering and such. man sed.

0

Share this post


Link to post
Share on other sites

Check out the SED/AWK book by O'reilly Press

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0