Tyler_Durden - Thanks for the speedy reply. I have modified the script to use the double quotes and to escape the other double quotes.
The script does work now! Awesome!
I did have a bit of a start when I ran it the first time and got an array that was only 4 rows long by tons of columns. Then I remembered that the "4" in the script referenced the number of rows in the input file so I changed that to 65537 so it would match my input file and voila!
I have to do some more studying on all the switches and get more familiar with perl on the command line. It is a lot like awk or sed. Very useful.
I am going to mess with the gawk script to see if it needs a bit of a tweak too.
Thanks a million - 10000Springs(BC)
---------- Post updated at 01:51 PM ---------- Previous update was at 01:09 AM ----------
Well I worked with this a bit last night to get the gawk script running. I was able to make it work but only if I left out the "sort".
From reading a bit of documentation it appears that there is no sort in gawk, it uses asort instead. Even knowing this I haven't been able to get it to fly yet and running without sorting the output gives totally unusable results.
I tried:
gawk script - gawk "NR<5 {a[$2]=$0;next} {a[$2]=a[$2] FS $NF}END {for (i in a) print a[i]|\"sort -n\"}" inputfilename
so that I have replaced the quotes with double-quotes and escaped the quotes around the 'sort -n' part after the pipe. This did not work.
The only way I could execute with on error was to leave the sort after the pipe out of the script.
I will be looking deeper into the asort function in gawk over the next day or two and will post a fix if I find one.
Does anyone have any tips for an alternate method of preserving the sort order of an input in a gawk script?
Thanks for looking. --10000Springs(BC)