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

ADVANCED PIPELINE COMMANDS Problem 5 (10 points): Answer the following questions

ID: 3852758 • Letter: A

Question

ADVANCED PIPELINE COMMANDS Problem 5 (10 points): Answer the following questions about the cut and tr commnands a) If you have a file called 'data.csv with several lines of data, each line containing comma-separated values, give the AWK command to print off the 8th number on each line (you have to tell AWK to use a comma as the separator using the -F flag, so look up this flag to see how to use it properly) b) Give the cut command for accomplishing the same thing that you did with c) If you have a file called 'records' with many lines of data, each line having d) Assume the same things from part (c), except now you want to obtain the 3rd e) Assume you want to read as input the file 'names.txt', change every lowercase AWK in part (a). values separated by a ':' character, how would you obtain the 5th value of each line using the cut command? character of the 5th value on each line. How would you do this using the cut command? HINI: You may use piping here letter to an uppercase letter and every to a '-, then save the result back to that same file (overwriting it). How would you do this with the tr command? HINT Use piping and file redirection

Explanation / Answer

Here are the answers, please rate the answer if it helped. Thank you.

a)
awk -F "," '{print $8}' data.csv

Above command uses AWK to read the data.csv file with comma as field separator and retrieves the 8th field

b)
cut -d "," -f8 data.csv

Above command uses "cut" to read the data.csv file with comma as field separator and retrieves the 8th field

c)
cut -d ":" -f5 records

Above command uses "cut" to read the data.csv file with colon as field separator and retrieves the 5th field

d)
cut -d ":" -f5 records | cut -c3

Above command uses "cut" to read the data.csv file with colon as field separator and retrieves the 5th field and then uses the "cut" command again
to fetch the 3rd character

e)
tr a-z A-Z < names.txt | tr # - > names.txt

Above command reads the names.txt input file, changes lower to upper case and # to - and then updates the same file

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