Hi
I have many files all with 1 field per line as in
12345
abcde
john.paul.net
6789101
how do I remove ceratin lines from these files.
Have tried sed but sed wrecks my head!
Many thanks in advance for any help
Hi
I have many files all with 1 field per line as in
12345
abcde
john.paul.net
6789101
how do I remove ceratin lines from these files.
Have tried sed but sed wrecks my head!
Many thanks in advance for any help
What does "certain" mean? Line numbers? "John Smith"?
Please give an example of input and expected output.
Hi Jim
Input file =
12345
qwerty
a2a3456tg
sdfgh
11111
22222
vvvvvvvvvvv
77777
23
111
Required output file =
12345
a2a3456tg
sdfgh
vvvvvvvvvvv
77777
23
111
$ ruby -ne 'print if !($_[/qwerty/] || $_[/22222/] || $_[/11111/])' file
Or does he mean by line numbers?
sed '2d;5,6d' infile
try:
sed -e '/qwerty\|11111\|22222/d'
Only GNU sed knows alternation ( | )
Awk does though:
awk '!/qwerty|11111|22222/' file
and so does grep:
grep -Ev "qwerty|11111|22222" file
Guys
Many thanks to you all for your help, in particular Scrutinizer which hits the nail on the head.
awk is doing the required stuff..
but when i tried the same with grep -Ev ....
it is giving :
grep: illegal option -- E
Usage: grep -hblcnsviw pattern file . . .
What Operating System are you using? On Solaris use /usr/xpg4/bin/grep
Otherwise, does egrep -v work?