Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tool Module Description cat tac Concatenate.py Concatenate.py CutPaste.py Concatenate files and print on the standard output Concatenate and print files in reverse Remove sections from

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Tool Module Description cat tac Concatenate.py Concatenate.py CutPaste.py Concatenate files and print on the standard output Concatenate and print files in reverse Remove sections from each line of files cut paste CutPaste.py Merge lines of files grep head tail Grep.py Partial.py Partial.py Sorting.py WordCount.py Print lines of files matching a pattern Output the first part of files Output the last part of files Sort lines of text files Print newline, word, and byte counts for each file sort WC Cut and paste tools ( cut and paste ) Because paste is used to create input data for the cut tool, I'll explain its use first. paste Paste joins two or more files together, inserting a comma in between $ python src/tt.py paste data/lets dataum2 a,1 b,2 Paste works by opening each file listed on the command line and storing the resulting file object in a list. Then a for loop iterates over the list of file objects, reading one line from each file and printing it with a comma instead of a newline. After the last file is read a newline is printed. The for loop over the files is repeated until all files are exhausted. The output of the paste command is as long as the longest file; missing fields are just empty strings $ python src/tt.py paste dataum2 data/let3 1,a 2,5 $ python src/tt.py paste dataum2 data/let3 data/words5 1, a, babbles 2,b, sneakiness ,C, trimly sagree ,, frankly $ python src/tt.py paste dataum2 data/words5 data/lets 1, babbles, a 2, sneakiness,b ,trimly, ,agree, ,frankly, When only one file is given paste behaves like cat $ python src/tt.py paste dataum10 Creating the file data/people.csv paste is used to create a single Comma Separated Values (CSV) file from multiple input files. $ python src/tt.py paste dataames8 data/ages8 data/colors8 data/verbs8, Name, Age, Favorite Color, Locomotion Style Adrianna, 22, Royal Blue, crawl Julian, 36,Midnight Blue, traipse Tiffany, 24, Light Salmon, push Savannah, 39, Antique White,march Abraham, 26,DarkSea Green, trot Michael, 23, Dodger Blue, lurch Marcus, 29, Dark Goldenrod, slink Julianna, 17, Snow, wriggle The resulting data can be redirected to a new file with the shell's redirection operator>. The output then does into the file instead of the screen. This example illustrates how to create a file named data/people.csv which is used to demonstrate the cut tool: $ python src/tt.py paste dataames8 data/ages8 data/colors8 data/verbs8 > data/people.csv Notice that after running this command the prompt immediately returns and nothing else is printed to the screen. The output was redirected into the new file data/people.csv instead of being displayed on the screen. Tool Module Description cat tac Concatenate.py Concatenate.py CutPaste.py Concatenate files and print on the standard output Concatenate and print files in reverse Remove sections from each line of files cut paste CutPaste.py Merge lines of files grep head tail Grep.py Partial.py Partial.py Sorting.py WordCount.py Print lines of files matching a pattern Output the first part of files Output the last part of files Sort lines of text files Print newline, word, and byte counts for each file sort WC Cut and paste tools ( cut and paste ) Because paste is used to create input data for the cut tool, I'll explain its use first. paste Paste joins two or more files together, inserting a comma in between $ python src/tt.py paste data/lets dataum2 a,1 b,2 Paste works by opening each file listed on the command line and storing the resulting file object in a list. Then a for loop iterates over the list of file objects, reading one line from each file and printing it with a comma instead of a newline. After the last file is read a newline is printed. The for loop over the files is repeated until all files are exhausted. The output of the paste command is as long as the longest file; missing fields are just empty strings $ python src/tt.py paste dataum2 data/let3 1,a 2,5 $ python src/tt.py paste dataum2 data/let3 data/words5 1, a, babbles 2,b, sneakiness ,C, trimly sagree ,, frankly $ python src/tt.py paste dataum2 data/words5 data/lets 1, babbles, a 2, sneakiness,b ,trimly, ,agree, ,frankly, When only one file is given paste behaves like cat $ python src/tt.py paste dataum10 Creating the file data/people.csv paste is used to create a single Comma Separated Values (CSV) file from multiple input files. $ python src/tt.py paste dataames8 data/ages8 data/colors8 data/verbs8, Name, Age, Favorite Color, Locomotion Style Adrianna, 22, Royal Blue, crawl Julian, 36,Midnight Blue, traipse Tiffany, 24, Light Salmon, push Savannah, 39, Antique White,march Abraham, 26,DarkSea Green, trot Michael, 23, Dodger Blue, lurch Marcus, 29, Dark Goldenrod, slink Julianna, 17, Snow, wriggle The resulting data can be redirected to a new file with the shell's redirection operator>. The output then does into the file instead of the screen. This example illustrates how to create a file named data/people.csv which is used to demonstrate the cut tool: $ python src/tt.py paste dataames8 data/ages8 data/colors8 data/verbs8 > data/people.csv Notice that after running this command the prompt immediately returns and nothing else is printed to the screen. The output was redirected into the new file data/people.csv instead of being displayed on the screen

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Describe the major barriers to the use of positive reinforcement.

Answered: 1 week ago