Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Login to the system Move the file named jabberwock.txt into your home directory

ID: 3803431 • Letter: L

Question

Login to the system

Move the file named jabberwock.txt into your home directory

Initiate a script named lab6pt1.txt // script lab6pt1.txt

Unfortunately, when jabberwock.txt was created, some problems occurred, and there are duplicate lines in the file. Remove the duplicate lines by using uniq, and redirecting the output to a file called jabber.txt // cat jabberwock.txt, uniq –u jabberwock.txt >> jabber.txt

Some of the lines which appear to be duplicates were not removed. You need to figure out why, change the lines in jabber.txt so that they are identical, then run your uniq filter again, redirecting the output to a file called jabberfinal.txt

jabberfinal.txt still has some duplicated text in it. These lines are fine, why? No need to answer this in your script.

Use some form of grep (grep, egrep or fgrep) to find each occurrence of brillig in jabberfinal.txt, and redirect the output to a file called jabbergrep.txt

Close your script

jabberwock.txt as follow,

jabberwock

Twas brillig, and the slithy toves
Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
All mimsy were the borogoves,
And the mome raths outgrabe.
And the mome raths outgrabe.

Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!

He took his vorpal sword in hand:
Long time the manxome foe he sought
So rested he by the Tumtum tree,
And stood awhile in thought.

And, as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!

One, two! One, two! And through and through
One, two! One, two! And through and through
The vorpa1 blade went snicker-snack!
The vorpal blade went snicker-snack!
He left it dead, and with its head
He left it dead, and with its head
He went galumphing back.
He went galumphing back.

And, hast thou slain the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callooh! Callay!
He chortled in his joy.

Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.

Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!

He took his vorpal sword in hand:
Long time the manxome foe he sought
So rested he by the Tumtum tree,
And stood awhile in thought.

And, as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!

One, two! One, two! And through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.

And, hast thou slain the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callooh! Callay!
He chortled in his joy.

Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
By Lewis Caroll

Explanation / Answer

Uniq command does not detect the repeated lines unless that are adjacent. In this case you are suppose to sort the input file before using uniq.

uniq –u jabberwock.txt >> jabber.txt

The symbol ">>" will append your output with the existing data. try creating new file and use a new file ">" instead of ">>"

grep -c "brilling" jabberfinal.txt > jabbergrep.txt

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote