Sample Header Ad - 728x90

Sorting files using a bash script

2 votes
2 answers
13759 views
I want to write a bash script that would read a file with 2 columns f 2 g 1 s 4 d 5 f 2 g 5 d 9 g 10 h 1 s 5 d 29 My script would actually sort this file based on the first column (alphabet) and produce a file called alpha_sorted.txt and then I want it to do the same thing for the numbers and name it numbers_sorted.txt. The script is meant to be for introductory level so complicating the methods is not advised. ### Update Using john1024's answer, I have the following problem: Hasan@HasanChr /cygdrive/c/users/Hasan/Desktop/Bash $ chmod +x script.sh Hasan@HasanChr /cygdrive/c/users/Hasan/Desktop/Bash $ ./script.sh cat: alpha_sorted.txt: No such file or directory Here is a screenshot of script.sh enter image description here
Asked by JavaFreak (93 rep)
Jun 12, 2016, 01:15 AM
Last activity: Aug 4, 2025, 01:30 PM