martedì 27 maggio 2014

Unix Tip: How to format LS output

I want to use Unix ls command output and write it to a well-formatted file
I just used the following command:

ls -ltra | awk -v OFS=";" '$1=$1'

in a bash script.
OFS parameter is used for specifying the separator for the file.

You can redirect the output to a file and then process it as it was a semicolon delimited file.