On  5 Oct, Andrew Bennetts wrote:
>  On Fri, Oct 05, 2001 at 04:02:16PM -1000, cpaul wrote:
> > 
> > hi - i have two plaintext files
> > 
> > i want to merge them, discarding duplicate lines
> > 
> > is there an easy way ?

You really need to say what you mean by merging the two files.
If you want to read one line at a time from each, and then remove
duplicate lines, you'd need something like

----- blend script: cut here ----
#!/bin/sh

MYNAME=`basename $0`

if [ $# != 2 ]
then
    echo "usage: $MYNAME file1 file2" >&2
    exit 1
fi

exec 3< $1
exec 4< $2

more=true
while $more
do
    more=false
    read line 0<&3 && echo "$line" && more=true
    read line 0<&4 && echo "$line" && more=true
done
----------------- cut here --------

Then you'd:

        blend file-a file-b | uniq

luke


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to