[lug] parsing between two lists

Riggs, Rob RRiggs at doubleclick.net
Wed Mar 27 13:30:32 MST 2002


Good ideas on both counts. I didn't think a temp file was appropriate for
this quick example. It seemed like an obvious optimization to me. But it's
probably a good idea to state it explicitly.

I am trying hard to wean myself from using "sed" where "cut" is more
appropriate. It's a bad habit I let myself get into. I've found myself
recently doing really dumb regex parsing of fixed length records where "cut"
was a much more efficient tool. This is a similar case. "cut" is a much
better choice. Thanks for pointing it out.

-----Original Message-----
From: Tkil [mailto:tkil at scrye.com]
Sent: Wednesday, March 27, 2002 12:27 PM
To: lug at lug.boulder.co.us
Subject: Re: [lug] parsing between two lists


>>>>> "Rob" == Rob Riggs <Riggs> writes:

Rob> Unique in list A: diff -u listA listB | grep ^- | sed 's/^.//g'
Rob> Unique in list B: diff -u listA listB | grep ^+ | sed 's/^.//g'
Rob> Common to both: diff -u listA listB | grep "^ " | sed 's/^.//g'

cute optimization is to diff to a temp file first, then yank out the
bits you want later.

also, "cut" might be faster than "sed".

yours in nugget polishing,
t.
_______________________________________________
Web Page:  http://lug.boulder.co.us
Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list