Rearranging many columns with awk
-
03-07-2021 - |
Question
I have a file with over 800 columns, and I want to perform some mild column rearrangement. In particular, I need to drop a few columns, and make the last column the first column.
I programmatically generate a simple awk script to perform the rearrangement. It looks like the following:
{
print $820,$2,$3,$4, [lots more here, but skipping a few], $819
}
On one computer, this works just fine. On another computer, it only works when I have a couple hundred columns selected, but for more columns, I get a core dump. Is there any way to make this more portable?
La solution
Installing gawk fixed this problem... not sure what version of awk was being used previously.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow