Sorting Homework - Sort list2 into list2.srt % sort...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Date: 4/23/2003 Course: Sorting Homework 1. In Exercise A, when you sorted cwords, what was the difference between (1) and (2) The –u (unique) option of the sort command eliminated all the sort results that were duplicates. On your cs account, is the default sort case sensitive or case insens- itive? It is case sensitive. 2. What command would you use to sort cwords backwards, showing only one occurrence of each word, saving the sorted list in a file called sorted.cwords? % sort -ru cwords> sorted.cwords 3. Show the commands you use as you do the following: Use the deroff command to convert bake.sale to list1 % deroff -w bake.sale> list1 Use it again to convert hold.bak to list2 % deroff -w hold.bak> list2 Sort list1 into list1.srt % sort list1> list1.srt
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sort list2 into list2.srt % sort list2> list2.srt Merge the two sorted files into list3 % sort -m list1.srt list2.srt> list3 Is list3 sorted? (Don't look at it. Use a command to check the file.) % sort -c list3 Yes it is sorted Try to merge the unsorted files? What happens? % sort -m list1 list2> list4 The result list4 is not sorted. 4. Add some more lines to the file names.dat, duplicating several last names and numbers. Sort the names.dat file using the second number as your primary key, the last name as your secondary key, and the first number as your ternary key. Do it using both the new and the old syntax. Show the command you used: New way: sort -k 5rn,5 -k 3b,3 -k 4rn,4 names.dat Old way: sort +4rn -5 +2b -3 +3rn -4 names.dat...
View Full Document

This note was uploaded on 02/01/2010 for the course CS 072 taught by Professor Reneea.fecteau during the Spring '03 term at San Jose State University .

Page1 / 2

Sorting Homework - Sort list2 into list2.srt % sort...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online