Magic Banana, on the subject of the -a argument of join:
The real "succinct one", as you write, would be without option -a. Neither -a 1 nor -a 2. That is what I meant.

Which is absolutely correct; subconsciously I was using -a as an either/or choice, but it's also useful to make the choice in the present anaylsis because unmatched lines indicate errors.

Magic Banana wondered about my inability to recognize those two arguments:
The two files? They are in the command line I gave.

The two files in the script that I immediately recognize as my own are PTRList.txt and IPv4.May2020.37.nMapoG.txt, I now appreciate that the first argument is the (presumably first) PTR in PTRList.txt, but that second one still
goes over my head. Let's look at Magic Banana's awk command:
awk 'FILENAME == ARGV[1] { a[$1] = $2 } FILENAME == ARGV[2] && $1 in a { print $2 >> "out/" a[$1] "," $1 }' PTRList.txt

Column $1 of PTRList.txt holds the multi-address PTR's; Column $2 holds the corresponding number of instances,
so ARGV[1] has to be www.newsgeni.us and ARGV[2] ought to be 10.

That makes the first trial command:
./MB.suggestion.bin www.newsgeni.us 10
Which elicits the following responses:
./MB.suggestion.bin: line 1: $: command not found
awk: cmd. line:1: (FILENAME=- FNR=2) fatal: can't redirect to `out/2,lo0-100.NYCMNY-VFTTP-421.verizon-gni.net' (No such file or directory)

I tried the two files instead, but I get the exact same responses as the first two arguments.

Here's the text of MB.suggestion.txt (from which MB.suggestion.bin was made):
$ mkdir out; sort -u IPv4.May2020.37.nMapoG.txt | awk 'FILENAME == ARGV[1] { a[$1] = $2 } FILENAME == ARGV[2] && $1 in a { print $2 >> "out/" a[$1] "," $1 }' PTRList.txt -

Just in case, I'll sort PTRList.txt before running ./MB.suggestion.bin in the second trial command: sort PTRList.txt > PTRListSort.txt ; ./MB.suggestion.sort.bin lo0-100.NYCMNY-VFTTP-421.verizon-gni.net 2 PTRList.txt was changed to PTRListSort.txt & MB.suggestion.sort.bin subsequently was made executable beforehand.

Terminal responses:
./MB.suggestion.sort.bin: line 1: $: command not found
awk: cmd. line:1: (FILENAME=- FNR=2) fatal: can't redirect to `out/2,lo0-100.NYCMNY-VFTTP-421.verizon-gni.net' (No such file or directory)

Now lo0-100.NYCMNY-VFTTP-421.verizon-gni.net in the error response is the same as the first argument of
MB.suggestion.sort.bin. That's progress.

George Langford

Reply via email to