Microsoft
Software
Hardware
Network
Question : A tiny Bash Script to sort and show
Hi:
Consider I have a text file as this one in attached, and I need a tiny Bash script to just sort it by its first field (the numeric field) and display it in the screen. Questions:
1) Is it possible to sort it in descending order? (just in case)
2) Is it possible to sort it by the first field and then by the second field? (just in case too)
Thanks.
Mario./
Answer : A tiny Bash Script to sort and show
cat filex.txt | sort -nr
will do the job
-n is for numeric sort and -r is for descending order
if u want to sort by the second field try
cat filex.txt | sort -k2
hope this is what you mean
Random Solutions
How to Copy the whole 200GB folder content from another server using SSH
Outlook 2007 will not open attachments or allow me to send attachments, instant preview window does not work
How do I install symantec antivirus on a Vista home premium machine. I get an error 1920
How to monitor changes in file content?
svchost 100%
Trimmed Average by Month
Log full on my watchguard 750 e firewall
stopping the spam
Exchange 2007 Activesync Sent Items
problem in installing plone