Compare 2 files question

Compare 2 files question

Post by Jon LaBadi » Fri, 30 Oct 1998 04:00:00




> I am having the hardest time trying to do the follwoing especially since I am
> a newbie to UNIX. I have 2 files:

> File 1 - record length of 16
> ------
> mynameismichaelaa
> mynameilisaaaaaaa

> File 2 - record length of 111
> ------
> mynameismichaelaa..............dddddd.................ddddddddd
> mynameilisaaaaaaa............cccc.....ccccc...........cccccssss

> I want to see if each record of File 1 exists in the first 16 bytes of File 2
> and if so, write out the line from File 2 to another file....

> Any help would be greatly appreciated, trying to do this for 2 days! Thanx.

sed 's/^/^/' short_line_file > /tmp/patterns
egrep -f /tmp/patterns long_line_file

--


 4455 Province Line Road        (609) 252-0159
 Princeton, NJ  08540-4322      (609) 683-7220 (fax)