![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Key Scripter 1.4 (Default branch) | iBot | Software Releases - RSS News | 0 | 05-06-2008 05:50 PM |
| Key Scripter 1.1 beta (Default branch) | iBot | Software Releases - RSS News | 0 | 03-11-2008 06:50 AM |
| Key Scripter 0.9 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-12-2008 01:30 PM |
| new scripter | Gwoodhouse0 | Shell Programming and Scripting | 1 | 09-26-2007 09:12 AM |
| Use of #! at the begining ? | jambesh | Shell Programming and Scripting | 1 | 07-24-2007 03:08 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Begining Shell scripter
I am trying to write for my class project a shell script, using bourne shell, that will take one command, either -l or -w. If -l is entered then the script should output the names of all the files in my working directory sorted in increasing order of the number of lines in the file. If -w is input then the same ill be done except that it will be sorted in increasing order by the number of words in the files. I know the solu'n will use the command ls and a pipeline to sort. but I don't know how to list the files or sort the files by the number of words or lines that they have. so far I have
#!/bin/sh print=`ls | sort` echo $print this is not exactly correct but if I knew how to sort the files according to the number of lines each had, then I could rearrange this code to adapt. Any help would be really appreciated. The project is not worth much at all but I am curious as how to sort this way. Thank you. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|