Many thanks to all - I ended up doing it in Perl, actually.
perl -e ' ($file1, $file2) = @ARGV; $printed = 0; open F2, $file2; while (<F2>) { $h2{$_}++ }; $count2 = $.; open F1, $file1; while (<F1>) { if (! $h2{$_}) { print $_; $printed++; } } $count1 = $.; warn "\nRead $count1 lines from $file1 and $count2 lines from $file2.\nPrinted $printed lines found in $file1 but not in $file2\n\n" ' 1.txt 2.txt > 3.txt
On Dec 8, 12:29Â am, Bill Hernandez <m...@mac-specialist.com> wrote: > Two files and one script... > > I changed the script slightly. > > Have fun... > > Bill Hernandez > Plano, Texas > > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+ > ~/Desktop/bb_test/a.txt > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+ > Ham > Cheese > Tuna > Lettuce > > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+ > ~/Desktop/bb_test/b.txt > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+ > Salt > Pepper > Vodka > Tuna > > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+ > -- script_name : a_minus_b.scpt > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+ > on run > Â Â Â Â set a_path to (do shell script ("echo " & "~/Desktop/bb_test/a.txt")) > Â Â Â Â set b_path to (do shell script ("echo " & "~/Desktop/bb_test/b.txt")) > > Â Â Â Â tell application "BBEdit" > Â Â Â Â Â Â Â Â open (POSIX file a_path) as alias > Â Â Â Â Â Â Â Â set a_props to get properties of text window 1 > Â Â Â Â Â Â Â Â set a_id to ID of a_props > > Â Â Â Â Â Â Â Â open (POSIX file b_path) as alias > Â Â Â Â Â Â Â Â set b_props to get properties of text window 1 > Â Â Â Â Â Â Â Â set b_id to ID of b_props > > Â Â Â Â Â Â Â Â set myOptions to {search mode:grep, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:true, extend selection:false} > > Â Â Â Â Â Â Â Â select text window id b_id > Â Â Â Â Â Â Â Â set n to count lines of text of text window 1 > > Â Â Â Â Â Â Â Â repeat with counter from 1 to n > Â Â Â Â Â Â Â Â Â Â Â Â select text window id b_id > Â Â Â Â Â Â Â Â Â Â Â Â select line counter of text of text window 1 > Â Â Â Â Â Â Â Â Â Â Â Â set search_str to contents of selection > Â Â Â Â Â Â Â Â Â Â Â Â select text window id a_id > Â Â Â Â Â Â Â Â Â Â Â Â replace search_str using "" searching in text 1 of text window 1 options myOptions > Â Â Â Â Â Â Â Â end repeat > > Â Â Â Â end tell > end run > -- +---------+---------+---------+---------+---------+---------+---------+---- -----+
-- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email "support@barebones.com" rather than posting to the group.
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!