How to remove common lines from a text file in Korn Shell

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
btna [ Di, 15 April 2008 22:11 ] [ ID #1942537 ]

Re: How to remove common lines from a text file in Korn Shell

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 [at] hp : com
Michael Tosch [ Di, 15 April 2008 22:56 ] [ ID #1942541 ]

Re: How to remove common lines from a text file in Korn Shell

On 2008-04-15, btna <btna [at] terra.com> 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
Chris Mattern [ Di, 15 April 2008 23:39 ] [ ID #1942543 ]
Linux » comp.unix.shell » How to remove common lines from a text file in Korn Shell

Vorheriges Thema: Anonymous functions
Nächstes Thema: suppressing nohup.out file