'sort' - sort lines of text - Video Man Pages

29/08/2025 6 min
'sort' - sort lines of text - Video Man Pages

Listen "'sort' - sort lines of text - Video Man Pages"

Episode Synopsis

The 'sort' command sorts lines of text.- Sort a file in ascending order: sort path/to/file- Sort a file in descending ("reverse") order: sort -r path/to/file- Sort using numeric rather than alphabetic order: seq 100 | sort -n NOTE Without -n, the sort would look like: 1 10 100 2 20 ...- Sort "randomly" (similar to the "shuf" command): seq 10 | sort -R NOTE 'sort -R' is MUCH slower than 'shuf' when used on large files!- Sort /etc/passwd by the 3rd field of each line numerically, using ":" as the field separator: sort -t : -k 3n /etc/passwd- Sort /etc/passwd by the 5th field and in "reverse" order, using ":" as the field separator: sort -t : -k 5r /etc/passwd- Sort preserving only "unique" lines: echo -e "1\n1\n1\n2\n3" | sort -u- Sort file1 using "numeric" and ""reverse sorting", printing "output" to file2: sort -nr file1 -o file2REFERENCED:► https://gitlab.com/dwt1/vidmanWANT TO SUPPORT THE CHANNEL? 💰 Patreon: https://www.patreon.com/distrotube 💳 Paypal: https://www.youtube.com/redirect?event=channel_banner&redir_token=QUFFLUhqazNocEhiaGFBT1l1MnRHbnlIcHFKbXJWVnpQd3xBQ3Jtc0tsLVZJc19YeFlwZ2JqbXVOa3g0Skw4TVhTV2otNm1tM3A1bUNnamh3S2V6OGQtLTBnSjBxYTlvUXMxeEVIS3o4US10NENHMUQ3STk2a01FOFBhUnZjZFctMEhFUTg1TVctQmFfVUdxZXJ4TDl0azlYNA&q=https%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_donations%26business%3Dderek%2540distrotube%252ecom%26lc%3DUS%26item_name%3DDistroTube%26no_note%3D0%26currency_code%3DUSD%26bn%3DPP%252dDonationsBF%253abtn_donateCC_LG%252egif%253aNonHostedGuest🛍️ Amazon: https://amzn.to/2RotFFi👕 Teespring: https://teespring.com/stores/distrotubeDT ON THE WEB:🕸️ Website: http://distro.tube📁 GitLab: https://gitlab.com/dwt1 🗨️ Mastodon: https://fosstodon.org/@distrotube👫 Reddit: https://www.reddit.com/r/DistroTube/📽️ Odysee: https://odysee.com/@DistroTube:2FREE AND OPEN SOURCE SOFTWARE THAT I LIKE:🌐 Brave Browser - https://brave.com/📽️ Open Broadcaster Software: https://obsproject.com/🎬 Kdenlive: https://kdenlive.org🎨 GIMP: https://www.gimp.org/💻 VirtualBox: https://www.virtualbox.org/🗒️ Doom Emacs: https://github.com/hlissner/doom-emacsYour support is very much appreciated. Thanks, guys!...https://www.youtube.com/watch?v=z55PFrvuBqk