4 ms·
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
by Galanwe 3y ago
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}'