Software programmer interested in SRE, DevOps, Machine Learning and Augmented Reality.
CLI sort tricks
If you are like me you might have used the sort(1) CLI utility more than once in your life. Today, I’ve found a trick that I’ve never used before, and hopefully it will help someone else in the future. Say that we have the following file to sort: fpdy 01 08 wcfo juvi 01 02 ejan urbx 04 03 ckbw fkzq 01 08 myaz fjie 04 09 rhvo almv 04 02 adhs cuah 07 04 gbyt chok 09 06 nqwo emjd 01 04 ledx npto 02 10 nqsc Now, supposed that I wanted to sort first by the third column and then for the second one, then one would do sort -k 3 foo.
I kept forgetting how to perform the equivalent of grep(1) in PowerShell. The simple answer is Select-String. It is aliased to sls. ipconfig | Select-String 192.168 I should probably add a permanent alias.