CMIS 325
Week 5
Using tr and friends in pipelines.
Using the 'alice' file
Hint: for most of these, pipe the output to more to see what you've done
before the next stage in the pipeline.
How many lines, words, characters are there:_______________________
Make all letters lowercase.
How many lines, words, characters are there:_____________________
From the original file
Strip out all characters except letters.
How many lines, words, characters are there:_____________________
How many of the characters of the file are letters:_____________________
Using the mathematical operation of subtraction, how many of the
characters of the file are not letters:_____________________
From the original file
Strip all but letters, spaces and newlines.
How many lines, words, characters are there:_____________________
From the original file
Strip all but the spaces. How many spaces are there:_____________________
What percentage of the file is spaces (hint: divide the number of
spaces by the total number of chars):_____________________
From the original file
Strip all but the newlines. How many newlines are there:_____________________
What percentage of the file is newlines:_____________________
From the original file
How many commas are there:_____________________
How many periods are there:_____________________
How many colons are there:_____________________
How many semicolons are there:_____________________
How many uppercase letters are there:____________
From the original file
lowercase all the letters, then strip all characters except letters, spaces, and newlines
(this will delete punctuation and digits)
How many lines, words, characters are there:_____________________
Then change each space to a newline, squeezing duplicates so that each word
is on a line by itself, with no "blank" lines.
How many lines, words, characters are there:_____________________
Then sort this. What is the second word in the sorted list (i.e. after all the a's)______
Then change the sort to include the -u option.
How many different words are in the file:_________
What is the last of those words in sorted order (hint: tail command):__________
Now repeat the above with your gutenberg novel
Novel's name:_____________________
How many lines, words, characters are there:_______________________
Make all letters lowercase.
How many lines, words, characters are there:_____________________
From the original file
Strip out all characters except letters.
How many lines, words, characters are there:_____________________
How many of the characters of the file are letters:_____________________
Using the mathematical operation of subtraction, how many of the
characters of the file are not letters:_____________________
From the original file
Strip all but letters, spaces and newlines.
How many lines, words, characters are there:_____________________
From the original file
Strip all but the spaces. How many spaces are there:_____________________
What percentage of the file is spaces (hint: divide the number of
spaces by the total number of chars):_____________________
From the original file
Strip all but the newlines. How many newlines are there:_____________________
What percentage of the file is newlines:_____________________
From the original file
How many commas are there:_____________________
How many periods are there:_____________________
How many colons are there:_____________________
How many semicolons are there:_____________________
How many uppercase letters are there:____________
From the original file
lowercase all the letters, then strip all characters except letters, spaces, and newlines
(this will delete punctuation and digits)
How many lines, words, characters are there:_____________________
Then change each space to a newline, squeezing duplicates so that each word
is on a line by itself, with no "blank" lines.
How many lines, words, characters are there:_____________________
Then sort this. What is the second word in the sorted list (i.e. after all the a's)______
Then change the sort to include the -u option.
How many different words are in the file:_________
What is the last of those words in sorted order (hint: tail command):__________