How could I change the order of fields from a given command?
As an example take the output of
ls -l. By default the file name is displayed as the last field of the output. What could I pipe that output to in order to make the file name the first field shown?
My initial thought was to use the cut command, but regardless of the order in which fields are passed to the -f option they're always outputted in the original order.
Note: I'm only using
ls -l as an easy example, but I'd like to find a general purpose idiom that could be used for any command that outputs data in columns. If it could also be applied to delimited data that would be great too.