system
1
now i have a lot of words i need to grep out of a certain line but i have to keep typing this:
ex
ls -l | grep -v this | grep -v that | grep -v those | grep -v them .....
i mean, it goes on like that. there has to be a way to grep all those words without having to specify that "grep -v"
does anyone know how to do this?
vino
2
I dont have access to a unix box right now. But there is a -E flag. Try grep -vE (this|that|those|them)
grep available in /usr/bin/grep doesnt have the -E option
make use of the grep in
/usr/xpg4/bin/grep -E 'some1|some2' filename
system
4
thanks guys. but i need to grep out quite more than 2 words. will the above suffice?
yes very much...
just extend the list delimited by '|'
To grep multiple words in file, u can use egrep.
/uday> egrep 'word1|word2|word3|word4' filename
Uday