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 cut , in contrast to paste , extracts fields (or columns) of data from a single CSV file given as an argument. By default the 1st column is extracted: $ python src/tt.py cut data/people.csv Name Adrianna Julian Tiffany Savannah Abraham Michael Marcus Julianna Use the -f flag to specify which field to extract by its number. Unlike lists in Python, cut 's field, numbers begin with 1 and not e. You'll need to take this into account. $ python src/tt.py cut -f 2 data/people.csv Age A list of fields (possibly non-consecutive) may be specified. Separate each field in the list with commas. $ python src/tt.py cut -f 2,4 data/people.csv Age, Locomotion Style 22, crawl 36,traipse 24, push 39, march 26, trot 23, lurch 29, slink 17,wriggle When the user specifies an out-of-order list, cut will nevertheless print the fields in ascending order, as though the field specification is sorted within the program. Notice that this command's output is identical to the command above: $ python src/tt.py cut -f 4,2 data/people.csv Age, Locomotion Style 22, crawl 36,traipse 24, push 39, march 26, trot 23, lurch 29, slink 17,wriggle cut can process multiple files; each file is handled in the order given on the command line. First, create a new CSV file called data/kids.csv: $ python src/tt.py paste dataumle dataames10 data/words5 > data/kids.csv Now run cut with the -f option and both CSV files: $ python src/tt.py cut -f 2 data/kids.csv data/people.csv Jerry Bailey Frank Kai Angela Mikayla Hazel Karen Alexa Isabel Age Field numbers greater than the number of fields present in a file are treated as though they were empty. Care must be taken to prevent Python from raising an IndexError Notice the excess of blank lines produced by this command: $ python src/tt.py cut -f 13 data/people.csv Notice the excess of blank lines produced by this command; half of the lines in data/kids.csv have a blank 3rd field. $ python src/tt.py cut -f 3 data/kids.csv babbles sneakiness trimly agree frankly 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 cut , in contrast to paste , extracts fields (or columns) of data from a single CSV file given as an argument. By default the 1st column is extracted: $ python src/tt.py cut data/people.csv Name Adrianna Julian Tiffany Savannah Abraham Michael Marcus Julianna Use the -f flag to specify which field to extract by its number. Unlike lists in Python, cut 's field, numbers begin with 1 and not e. You'll need to take this into account. $ python src/tt.py cut -f 2 data/people.csv Age A list of fields (possibly non-consecutive) may be specified. Separate each field in the list with commas. $ python src/tt.py cut -f 2,4 data/people.csv Age, Locomotion Style 22, crawl 36,traipse 24, push 39, march 26, trot 23, lurch 29, slink 17,wriggle When the user specifies an out-of-order list, cut will nevertheless print the fields in ascending order, as though the field specification is sorted within the program. Notice that this command's output is identical to the command above: $ python src/tt.py cut -f 4,2 data/people.csv Age, Locomotion Style 22, crawl 36,traipse 24, push 39, march 26, trot 23, lurch 29, slink 17,wriggle cut can process multiple files; each file is handled in the order given on the command line. First, create a new CSV file called data/kids.csv: $ python src/tt.py paste dataumle dataames10 data/words5 > data/kids.csv Now run cut with the -f option and both CSV files: $ python src/tt.py cut -f 2 data/kids.csv data/people.csv Jerry Bailey Frank Kai Angela Mikayla Hazel Karen Alexa Isabel Age Field numbers greater than the number of fields present in a file are treated as though they were empty. Care must be taken to prevent Python from raising an IndexError Notice the excess of blank lines produced by this command: $ python src/tt.py cut -f 13 data/people.csv Notice the excess of blank lines produced by this command; half of the lines in data/kids.csv have a blank 3rd field. $ python src/tt.py cut -f 3 data/kids.csv babbles sneakiness trimly agree frankly

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions