Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Linux in General => Linux Development & Programming => Topic started by: ziox on January 04, 2005, 12:33:58 AM

Title: grep , sed or awk
Post by: ziox 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 ...
Title: grep , sed or awk
Post by: unixadmin 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!
Title: grep , sed or awk
Post by: Gray 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