Selecting columns to print with awk
One method would be to parse the output of ls
.
Example
$ ls -lah | awk '{print $9, $5}' | tail -5
.yEd 4.0K
.youtube-dl 4.0K
.zenmap 4.0K
.zshrc 32
zzzz 3.3K
By the way, you can clean up the output using column
.
$ ls -lah | awk '{print $9, $5}' | column -t | tail -5
z 4
.youtube-dl 4.0K
.zenmap 4.0K
.zshrc 32
zzzz 3.3K
Selecting columns to remove with awk
If you'd rather remove the other columns, while keeping others you can use this awk
method to blank out the undesirable columns.
Example
$ ls -lah | awk '{$1=$2=$3=$4=$6=$7=$8=""}1' | tail -5
4.0K .youtube-dl
4 z -> zzzz
4.0K .zenmap
32 .zshrc
3.3K zzzz
Eventual solution
The OP came up with this chain of commands, using a mix of the examples from above.
$ ls -lah | awk '{print $5, $9$10$11}' | column -t | column
...
4.0K .gphoto 773 .rdebug_hist 4.0K .youtube-dl
1.5K .grip 4.0K .rdesktop 4 z->zzzz
ls -lah | awk '{print $5, $9$10$11}'|column
I get what I wanted – rubo77 Nov 21 '13 at 00:59column
– rubo77 Nov 21 '13 at 01:01ls -lahQ
to quote filenames instead – rubo77 Nov 21 '13 at 01:11| column -t | column
you get the right formatting back. This works best for me:ls -lah | awk '{print $5, $9$10$11}' | column -t | column
– rubo77 Nov 21 '13 at 01:17