How to remove common lines from a text file in Korn Shell
am 15.04.2008 22:11:56 von btna
Hi all,
I have a file that looks like:
*/tmp/dst/file1*234*RW*6790
*/tmp/dst/file2*568*RW*908
*/tmp/dst/file3*345*RW*746
*/test/flm/file4*354*RW*987
*/test/flm/file5*643*RW*645
I need to keep all of the lines with the exception of the one with
file1 and file3 which have in common "/tmp/dst". I need to preserve
the line /tmp/dst/file2 plus the others that start with */test
Any ideas on how to do this with korn shell?
Thanks!
BTNA
Re: How to remove common lines from a text file in Korn Shell
am 15.04.2008 22:56:31 von Michael Tosch
btna wrote:
> Hi all,
>
> I have a file that looks like:
>
>
> */tmp/dst/file1*234*RW*6790
> */tmp/dst/file2*568*RW*908
> */tmp/dst/file3*345*RW*746
> */test/flm/file4*354*RW*987
> */test/flm/file5*643*RW*645
>
>
> I need to keep all of the lines with the exception of the one with
> file1 and file3 which have in common "/tmp/dst". I need to preserve
> the line /tmp/dst/file2 plus the others that start with */test
>
>
> Any ideas on how to do this with korn shell?
>
> Thanks!
> BTNA
grep -v '/tmp/dst/file[13]' file
--
Michael Tosch @ hp : com
Re: How to remove common lines from a text file in Korn Shell
am 15.04.2008 23:39:06 von Chris Mattern
On 2008-04-15, btna wrote:
> Hi all,
>
> I have a file that looks like:
>
>
> */tmp/dst/file1*234*RW*6790
> */tmp/dst/file2*568*RW*908
> */tmp/dst/file3*345*RW*746
> */test/flm/file4*354*RW*987
> */test/flm/file5*643*RW*645
>
>
> I need to keep all of the lines with the exception of the one with
> file1 and file3 which have in common "/tmp/dst". I need to preserve
> the line /tmp/dst/file2 plus the others that start with */test
>
>
> Any ideas on how to do this with korn shell?
>
grep -v /tmp/dst/file1 input-file | grep -v /tmp/dst/file3
--
Christopher Mattern
NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities