Hey everyone I am making an awk bash script that will take an input text file such as:
1111 Joe Brown
2222 Charlie Rogers
3333 Chris Williams
4444 Rob Black
And simply reverse the order of the rows, so output would be:
4444 Rob Black
3333 Chris Williams
2222 Charlie Rogers
1111 Joe Brown
I am getting a syntax error saying that there is an error near "(" and also that I have an extra "{" I cannot figure out what is happening here is my code:
#!/bin/bash
awk '{a[NR]=$0} END (for(i=NR; i>=1; i--)) printf("%s\n",a[i])}'