Jump to content


Photo
- - - - -

grepp'in till the mornin' come


  • Please log in to reply
8 replies to this topic

#1 masakari098

masakari098

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 387 posts

Posted 16 June 2004 - 07:45 PM

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, 16 June 2004 - 08:02 PM.


#2 Belgarath

Belgarath

    That's so raven!

  • Banned
  • 395 posts

Posted 16 June 2004 - 08:06 PM

file.txt:
ls -lk

test.sh:
#!/bin/bash
$(cat file.txt) | grep pr0n > pr0n.list

#3 masakari098

masakari098

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 387 posts

Posted 16 June 2004 - 08:10 PM

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

#4 masakari098

masakari098

    SUPR3M3 31337 Mack Daddy P1MP

  • Members
  • 387 posts

Posted 16 June 2004 - 10:09 PM

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, 16 June 2004 - 11:13 PM.


#5 Belgarath

Belgarath

    That's so raven!

  • Banned
  • 395 posts

Posted 17 June 2004 - 07:57 PM

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

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

#6 afgeek

afgeek

    the 0ne

  • Members
  • 1 posts

Posted 18 June 2004 - 04:35 PM

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

#7 Bizurke

Bizurke

    Thought Criminal

  • Members
  • 1,018 posts
  • Gender:Male
  • Location:NoDak

Posted 22 June 2004 - 10:00 AM

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

#8 Zeigenfus

Zeigenfus

    Sick in the head

  • Banned
  • 337 posts

Posted 23 June 2004 - 06:01 AM

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

#9 superflyzx3

superflyzx3

    I broke 10 posts and all I got was this lousy title!

  • Members
  • 13 posts

Posted 23 June 2004 - 09:54 AM

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




BinRev is hosted by the great people at Lunarpages!