November 22, 2024, 05:07:08 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: grep , sed or awk  (Read 8209 times)

Offline ziox

  • Linux Noob !
  • *
  • Posts: 12
    • http://groups.yahoo.com/group/linuxCity/
grep , sed or awk
« on: January 04, 2005, 12:33:58 AM »
HellO...

how can i grep a specific string ???
i want to grep something like this <whatIwant> i want this only So
i tried
grep -o "\<*\>" file > tofile Didn't work
grep -o "<*>" file > tofile Didn't work also
i want to grep just words between this '<' and this '>' symbols

grep,sed or awk all any ...

Offline unixadmin

  • Linux Noob !
  • *
  • Posts: 5
grep , sed or awk
« Reply #1 on: June 15, 2005, 03:49:49 AM »
This may help you get closer to what you are looking for:

grep "<.*>" file > tofile

If you want to remove the "<>" from the output, check out the command cut.  

Hope this helps!

Offline Gray

  • Linux Noob !
  • *
  • Posts: 5
grep , sed or awk
« Reply #2 on: June 21, 2005, 02:30:09 PM »
why are you adding '<' and '>' you do not need them for grep to work

just say
grep string file

and you are done

use ' ' to enclose strings if their is space in between them