The awk command is frequently used for this task.
- To print the fifth column, use the following command:
$ awk '{ print $5 }' filename
- We can print multiple columns and insert a custom string between the columns.
The following command will print the permission and filename of each file in the current directory:
$ ls -l | awk '{ print $1 " : " $8 }'
-rw-r--r-- : delimited_data.txt
-rw-r--r-- : obfuscated.txt
-rw-r--r-- : paste1.txt
-rw-r--r-- : paste2.txt