sort¶
Generate an XKCD #936 style 4 word password¶
sort -R /usr/share/dict/british | grep -v -m4 ^\{1,10\}$ | tr [:upper:] [:lower:] | tr "\n" " " | tr -d "'s" | xargs -0 echo
intersection between two files¶
Poor man's unsort (randomize lines)¶
Read, sort and confirm uniqueness of entries in files and directories¶
Pass TAB as field separator to sort, join, cut, etc.¶
Sort IPV4 ip addresses¶
Randomize lines in a file¶
List of directories sorted by number of files they contain.¶
sort -n <( for i in $(find . -maxdepth 1 -mindepth 1 -type d); do echo $(find $i | wc -l) ": $i"; done;)
Sort lines using the Xth characted as the start of the sort string¶
To have only unique lines in a file¶
Sort output by length of line¶
sortwc () { local L;while read -r L;do builtin printf "${#L}@%s\n" "$L";done|sort -n|sed -u 's/^[^@]*@//'; }
List your MACs address¶
Sort IP addresses¶
sort monthwise¶
Randomize lines (opposite of | sort)¶
Pick a random line from a file¶
sort ugly text¶
Sort dotted quads¶
Sort Apache access.log by date and time¶
sort -s -b -t' ' -k 4.9,4.12n -k 4.5,4.7M -k 4.2,4.3n -k 4.14,4.15n -k 4.17,4.18n -k 4.20,4.21n access.log*
Count unique lines in file sorted by instance count (descending) and alphabetically (ascending)¶
sort a list of comma separated numbers: sort_csn¶
sort_csn () { echo "${1}" | sed -e "s/,/\n/g"| sort -nu | awk '{printf("%s,",$0)} END {printf("\n")}' | sed -e "s/,$//"; }
Sort IPv4 address in order¶
sort the contents of a text file in place.¶
Remove duplicate line in a text file.¶
sort a csv file according to a particular n th field numerically (quicker than excel)¶
Sort using kth column using : delimiter¶
Unique sort¶
Unique sort¶
Show duplicate lines in a file¶
Pass TAB as field separator to sort, join, cut, etc.¶
Sort IPV4 ip addresses¶
Randomize lines in a file¶
List of directories sorted by number of files they contain.¶
sort -n <( for i in $(find . -maxdepth 1 -mindepth 1 -type d); do echo $(find $i | wc -l) ": $i"; done;)
Sort lines using the Xth characted as the start of the sort string¶
To have only unique lines in a file¶
Sort output by length of line¶
sortwc () { local L;while read -r L;do builtin printf "${#L}@%s\n" "$L";done|sort -n|sed -u 's/^[^@]*@//'; }
List your MACs address¶
Sort IP addresses¶
sort monthwise¶
Randomize lines (opposite of | sort)¶
Pick a random line from a file¶
sort ugly text¶
Sort dotted quads¶
Sort Apache access.log by date and time¶
sort -s -b -t' ' -k 4.9,4.12n -k 4.5,4.7M -k 4.2,4.3n -k 4.14,4.15n -k 4.17,4.18n -k 4.20,4.21n access.log*
Count unique lines in file sorted by instance count (descending) and alphabetically (ascending)¶
sort a list of comma separated numbers: sort_csn¶
sort_csn () { echo "${1}" | sed -e "s/,/\n/g"| sort -nu | awk '{printf("%s,",$0)} END {printf("\n")}' | sed -e "s/,$//"; }
Sort IPv4 address in order¶
sort the contents of a text file in place.¶
Remove duplicate line in a text file.¶
sort a csv file according to a particular n th field numerically (quicker than excel)¶
Sort using kth column using : delimiter¶
Unique sort¶
Last update: August 10, 2022
Created: August 10, 2022
Created: August 10, 2022