News for hackers. Stuff that matters.
Re:Learn GNU Awk with hundreds of examples and exercises by Galanwe on Monday August 28, 2023 @12:37PM (#37296811)
Neat, but both your tricks (rev and xargs) are more for getting the last word than getting the nth word.

For the sake of the argument, say I have the following fixed output and want the sizes:

    $ ls -l
    -rw-rw-r-- 1 userAAA group      588 Aug 29 00:25 file1
    -rw-rw-r-- 1 userAA  groupB   11870 Aug 29 00:24 file2
    -rw-rw-r-- 1 userA   groupBB   1166 Aug 28 23:56 file3
    -rw-rw-r-- 1 user    groupBBB   195 Aug 28 23:56 file4
I would just do:

    $ ls -l | awk '{print $5}'

There are no comments on this comment yet.