Hi,
I have identified how to use command chaining as per below on a file, to capture the header of a file, as well as the line containing the C: drive.
$ cat test.txt
Filesystem Size Used Avail Use% Mounted on
rootfs 237G 153G 84G 65% /
none 237G 153G 84G 65% /dev
none 237G 153G 84G 65% /run
none 237G 153G 84G 65% /run/lock
none 237G 153G 84G 65% /run/shm
none 237G 153G 84G 65% /run/user
C: 237G 153G 84G 65% /mnt/c
$ cat <(head -n1 test.txt) <(awk '/C/' test.txt)
Filesystem Size Used Avail Use% Mounted on
C: 237G 153G 84G 65% /mnt/c
I am trying to use the same logic on the output of a command, but it does not work. How can I get this to work?
Aim is to sort docker images by size column on the right, while printing the first line (header).
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest 4d90542f0623 5 days ago 5.58MB
ubuntu xenial 13c9f1285025 6 days ago 119MB
ubuntu latest 4c108a37151f 6 days ago 64.2MB
centos latest 9f38484d220f 3 months ago 202MB
linode/lamp latest 2359fa12fded 4 years ago 372MB
$ docker image ls | awk 'NR>1' | sort -k5 -V -r
linode/lamp latest 2359fa12fded 4 years ago 372MB
centos latest 9f38484d220f 3 months ago 202MB
ubuntu xenial 13c9f1285025 6 days ago 119MB
ubuntu latest 4c108a37151f 6 days ago 64.2MB
alpine latest 4d90542f0623 5 days ago 5.58MB
$ docker image ls | (awk 'NR==1') <(sort -k5 -V -r)
-bash: syntax error near unexpected token `<(sort -k5 -V -r)' <----- failure
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest 4d90542f0623 5 days ago 5.58MB
ubuntu xenial 13c9f1285025 6 days ago 119MB
ubuntu latest 4c108a37151f 6 days ago 64.2MB
centos latest 9f38484d220f 3 months ago 202MB
linode/lamp latest 2359fa12fded 4 years ago 372MB
Thanks