What is Nostr?
Jan Schaumann /
npub1kvy…edh2
2024-03-22 17:20:12

Jan Schaumann on Nostr: Today in stupid #unix #shell games: sorting by numeric IPv4 address Input: a file ...

Today in stupid #unix #shell games: sorting by numeric IPv4 address

Input: a file with '|' separated fields with IPv4 addresses in the third field

awk -F'|' '{print $3 "%" $0 }' | # pull the address to the front \
sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | # numerically sort each octet in order \
sed -e 's/^.*%//' # strip the leading field again
Author Public Key
npub1kvy8enal7npw9ct28tc53d4r5fl7q7a3ua3gku22z8jlyec37f3snmedh2