I am using cut command in command line and seems I can't get the output I like. Do you have any idea why I am getting this? Is it something that I do wrong?
This is the normal output and I would like to output in different order:
[root@upbvm500 root]# ls -al IDS_DIR/a | tr -s " "
-rw-r--r-- 1 root root 0 Jan 1 17:18 IDS_DIR/a
[root@upbvm500 root]#
[root@upbvm500 root]# ls -al IDS_DIR/a | tr -s " " | cut -d" " -f5,6,7,8,3,4,1
-rw-r--r-- root root 0 Jan 1 17:18
But as you can see, this is not working like expected. Any idea why they are switching places?
From man cut
:
Selected input is written in the same order that it is read, and is written exactly once.
Use awk '{print $5,$6,$7,$8,$3,$4,$1}'
instead of cut
.