In: Computer Science
using lunix or C programming to answer this lab please fill in the blanks with the answere being highlighted, so i can understand.
First, type the following command:
sort employee
What is the order that employee is sorted in? ___________________________________________
Give a brief description of how the file is sorted. _____________________________________________________________________________________________________________________________________________________________________________________________________
Now, sort on the field for last name.
sort +1 employee
Look at the sorted file. Are all the names sorted in alphabetical order? ______________________
Give a brief description of the output.______________________________________________________________________________________________________________________________________________________________________________________________________________
Sort the file again using the following command:
sort -f +1 employee
What happens when you sorted it this time? ________________________________________________________________________________________________________________________________________________________________________________________________________
Type in:
sort +3 employee > hired1
Use the cat command to list out the file hired1 to see the results. Are the hire dates sorted in order? _______________
If not, what has happened? _____________________________________________________________________________________________________________________________________________
Type in:
sort -n +3 employee > hired2
What is the result of the sort? _______________________________________________________________________________________________________________________________________________
Type in:
sort -nb +3.4 employee > hired3
What was the result? ________________________________________________________________________________________________________________________________________________
Briefly explain what happened. ____________________________________________________________________________________________________________________________________________
Type in:
sort +0 +4n employee
What was the result? ________________________________________________________________________________________________________________________________________________
Were both columns sorted? __________________________
Type in the next command.
sort +0 -1 +4n employee
What were the results of this output. Was the file sorted on both the department and also the salary field?
Subject |
Book Title |
Author's Last Name |
Author's First Name |
Pub. Date |
Price |
UNIX: |
Introduction to UNIX: |
Wrightson: |
Kate: |
2003: |
45.00: |
UNIX: |
Just Enough UNIX: |
Anderson: |
Paul: |
2003: |
39.00: |
UNIX: |
Bulletproof UNIX: |
Gottleber: |
Timothy |
2002: |
48.00: |
UNIX: |
Learning the Korn Shell: |
Rosenblatt: |
Bill: |
1994: |
35.95: |
UNIX: |
A Student's Guide to UNIX: |
Hahn: |
Harley: |
1993: |
24.50: |
UNIX: |
Unix Shells by Example: |
Quigley: |
Ellie: |
1997: |
49.95: |
UNIX: |
UNIX and Shell Programming: |
Forouzan: |
Behrouz: |
2002: |
80.00: |
UNIX: |
UNIX for Programmers and Users: |
Glass: |
Graham: |
1993: |
50.00: |
SAS: |
SAS Software Solutions: |
Miron: |
Thomas: |
1993: |
25.95: |
SAS: |
The Little SAS Book, A Primer: |
Delwiche: |
Lora: |
1998: |
35.00: |
SAS: |
Painless Windows for SAS Users: |
Gilmore: |
Jodie: |
1999: |
40.00: |
SAS: |
Getting Started with SAS Learning: |
Smith: |
Ashley: |
2003: |
99.00: |
SAS: |
The How to for SAS/GRAPH Software: |
Miron: |
Thomas: |
1995: |
45.00: |
SAS: |
The Output Delivery System: |
Haworth: |
Lauren: |
2001: |
48.00: |
SAS: |
Proc Tabulate by Example: |
Haworth: |
Lauren: |
1999: |
42.00: |
SAS: |
SAS Application Programming: |
Dilorio: |
Frank: |
1991: |
35.00: |
SAS: |
Applied Statistics & SAS Programming: |
Cody: |
Ronald: |
1991: |
29.50: |
issue the command:
sort -n -t: +4 books
What is the result? ________________________________________________________________________________________________________________________________________________
Try another sort using the books file. Sort on the price field in reverse. Type in the following:
sort -nr -t: +5 books
What was the result? _______________________________________________________________________________________________________________________________________________
Try one more sort, this time saving the sort to a file. This sort will be on two fields. Put it into a new file called newbooks. Type in:
sort -t: +0 +1 books > newbooks
Look at the file, newbooks. What does the sorted file look like now?
__________________________________________________________________________________________________________________________________________________________________
1. First, type the following command:
sort employee
What is the order that employee is sorted in?
ascending order
2. Give a brief description of how the file is sorted.
lines starting with a digit will come before lines starting with a letter. lines starting with a lowercase letter will come before lines starting with same letter but in uppercase.
3. Now, sort on the field for last name.
sort +1 employee
Look at the sorted file. Are all the names sorted in alphabetical order? Give a brief description of the output.
Yes. But, The output is sorted on the field for last name.
4. Sort the file again using the following command:
sort -f +1 employee
What happens when you sorted it this time?
Ignore case. Output did not depend on uppercase and lowercase letters.
5. Type in:
sort +3 employee > hired1
Use the cat command to list out the file hired1 to see the results. Are the hire dates sorted in order? If not, what has happened?
No. employee names stored in the hired1 file with sorted order.
6. Type in:
sort -n +3 employee > hired2
What is the result of the sort?
Sorted according to numerical value and stored in hired2 file.
Please like the answer and do comment for any queries in any part f the answer.
Happy to help :)