Quantcast
Channel: User ozzy - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 31

Answer by ozzy for How to sort a file with multiple delimiters?

$
0
0

You could use this:

awk 'NR<=4 {print $0; next } { print $0 | "sort -k6,6 -t\\|" }' listing.txt

It runs awk on listing.txt; instead you could pipe the data into awk (leaving out the listing.txt at the end, of course). The awk-script prints the first four header lines as they are. The rest of the lines is piped into sort. Sort sorts the 6th column, identifying it using a delimiter equal to the pipe symbol.


Viewing all articles
Browse latest Browse all 31

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>