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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 "[email protected]" rather than posting to the group.