Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 4 Text Manipulation Complete the following exercises, making sure to follow the instructions carefully. Dont forget to put your name in the top right-hand

Lab 4 Text Manipulation

Complete the following exercises, making sure to follow the instructions carefully. Dont forget to put your name in the top right-hand corner of this document and rename the file to Lab4-Lastname, using your last name instead of lastname, before submitting via Blackboard.

Exercise 4-1

  1. Type cat testfile.001 and hit enter. Your cursor will blink, allowing you to type any text you wish. Type the following phrase, including a space at the end, before pressing Ctrl + D on your keyboard to end the command: We the people of the United States,
  2. Now type cat testfile.002 and hit enter. Once again, your cursor will blink, allowing you to type any text you wish. Type the following phrase, including a space at the end, before pressing Ctrl + D again: in order to form a more perfect union,
  3. Using the same method above, create testfile.003 with the following phrase, including a space at the end, before typing Ctrl + D: insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessings of liberty to ourselves and our posterity,
  4. Using the same method above, create testfile.004 with the following phrase before typing Ctrl + D: do ordain and establish this Constitution for the United States of America.
  5. Type cat testfile.* > preamble and hit enter.
  6. Type cat preamble. What does the file contain? ________________________________________________________________________________________________________________________________________________
  7. Type wc preamble and hit enter. How many lines are in the file? ___________ How many words? _____________________ How many characters? _________________
  8. Type cat < preamble and hit enter. What happened, and why? ________________________________________________________________________________________________________________________________________________________________________________________________________________________
  9. Type ls /bin/user/news 2>> errorlog.txt and hit enter. What happened, and why? ________________________________________________________________________________________________________________________________________________________________________________________________________________________
  10. Issue the command history | cat >> lastname4-1, using your last name instead of lastname. Make sure to upload this file when submitting this assignment on BlackBoard.
  11. Once the file in step 10 is created, use the history -c command to clear your command history.

Exercise 4-2

Create a plaintext file with the following words typed out, in order and as specified:

Apple

Grape

Pear

Strawberry

Banana

Blueberry

Mango

Orange

Kiwi

Cherry

Create a single command, using pipes, that will display the file sorted in reverse order and excluding all lines that include the character p.

What is the command? _______________________________________________________

Run the command again, this time redirecting the output to a file called lastname4-2, using your last name instead of lastname. Make sure to upload this file when submitting this assignment on BlackBoard.

Exercise 4-3

Create a plaintext file with the following words typed out, in order and as specified:

Onion

Carrot

Asparagus

Broccoli

Cauliflower

Carrot

Lettuce

Lettuce

Corn

Celery

Create a single command using pipes that will display the first five lines of the file sorted in order with duplicates removed.

What is the command? _______________________________________________________

Run the command again, this time redirecting the output to a file called lastname4-3, using your last name instead of lastname. Make sure to upload this file when submitting this assignment on BlackBoard.

Exercise 4-4

Briefly explain what each of the following redirection characters mean.

> _______________________________________________

>> _______________________________________________

< _______________________________________________

2> _______________________________________________

2>> _______________________________________________

&> _______________________________________________

&>> _______________________________________________

Exercise 4-5

Provide the filename for each of the following:

Standard error ____________________________________

Standard input ____________________________________

Bit bucket ____________________________________

Standard output ____________________________________

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions

Question

Describe your ideal working day.

Answered: 1 week ago