|
Home > Archive > Unix questions > April 2004 > Unix
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| escobo 2004-04-19, 9:34 pm |
| Listing The file data.txt has the following structure:
Item1 Item2 ... ItemN
------------------------------------------------
Value11 Value21 ... ValueN1
Value12 Value22 ... ValueN2
: : :
Value1M Value2M ... ValueNM
Create a script that displays the information from the file data.txt
sorted by some criteria. Your script should have the following input
parameters:
listing -h -ilist -olist -ffile
-h displays help
-ilist, list defines criteria for sorting,
-olist, list defines which values will be displayed on the output,
-ffile, name of the input file.
Example
listing -i3,4 -o2,1 -fstudents.txt
file students.txt has the following contents
Surname Name Class Group
---------------------------------------
Novak Petr 3 24
Dvorak Jiri 3 24
Kovarikova Lenka 3 23
Michalek Karel 4 12
Cesilko Mirek 3 23
The script listing displays
Class 3
Group 23
Lenka Kovarikova
Mirek Cesilko
Group 24
Petr Novak
Jiri Dvorak
Class 4
Group 12
Karel Michalek
| |
| Chris F.A. Johnson 2004-04-19, 9:34 pm |
| On Tue, 20 Apr 2004 at 00:46 GMT, escobo wrote:
> Listing The file data.txt has the following structure:
> Item1 Item2 ... ItemN
> ------------------------------------------------
> Value11 Value21 ... ValueN1
> Value12 Value22 ... ValueN2
>: : :
> Value1M Value2M ... ValueNM
>
> Create a script that displays the information from the file data.txt
> sorted by some criteria. Your script should have the following input
> parameters:
> listing -h -ilist -olist -ffile
> -h displays help
> -ilist, list defines criteria for sorting,
> -olist, list defines which values will be displayed on the output,
> -ffile, name of the input file.
[rest of homework assignment snipped]
You're in luck!
All your questions have already been answered in the
comp.unix.shell newsgroup. If you search the archives at
<http://groups.google.com/groups?group=comp.unix.shell>, you'll
find everything you need.
If you need more help, post the problem sections of your script to
the comp.unix.shell newsgroup. Be sure to explain exactly what is
going wrong (cut and paste error messages and incorrect output).
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
========================================
===========================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
|
|
|
|
|