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

TaskA: Make a one-line Unix command - using pipe(s) - to display the number of f

ID: 3907727 • Letter: T

Question

TaskA: Make a one-line Unix command - using pipe(s) - to display the number of files in your home directory including the hidden files that begin with '.'
Note: Output will be the number of files you have in your directory

Task B: Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort).
Note: Output will be the number: 33
Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Output is this..
DARWIN CHARLES EINSTEIN ALBERT    GALILEO GALILELI    GOLDMAN EMMA    LOVELACE ADA MANDELA NELSON    PARKS ROSA    RUSSELL BERTRAND
Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.
Note: Here is what the output should look like:
moose bullwinkle 94111 franti michael 94112 marley bob 94112 richards keith 94112 simone nina 94112 einstein albert 94113 russell bertrand 94113 oliver mary 94114 hanh thichNhat 94115 kropotkin peter 94115 chomsky noam 94116 squirrel rocketJ 94122 chapman tracy 94211 marley rita 94212 black mary 94221
Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon). Hint: Cut the first part of the date command then pipe to tr. Note: Example for output would be wed if I run the command on a Wednesday TaskA: Make a one-line Unix command - using pipe(s) - to display the number of files in your home directory including the hidden files that begin with '.'
Note: Output will be the number of files you have in your directory

Task B: Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort).
Note: Output will be the number: 33
Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Output is this..
DARWIN CHARLES EINSTEIN ALBERT    GALILEO GALILELI    GOLDMAN EMMA    LOVELACE ADA MANDELA NELSON    PARKS ROSA    RUSSELL BERTRAND
Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.
Note: Here is what the output should look like:
moose bullwinkle 94111 franti michael 94112 marley bob 94112 richards keith 94112 simone nina 94112 einstein albert 94113 russell bertrand 94113 oliver mary 94114 hanh thichNhat 94115 kropotkin peter 94115 chomsky noam 94116 squirrel rocketJ 94122 chapman tracy 94211 marley rita 94212 black mary 94221
Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon). Hint: Cut the first part of the date command then pipe to tr. Note: Example for output would be wed if I run the command on a Wednesday TaskA: Make a one-line Unix command - using pipe(s) - to display the number of files in your home directory including the hidden files that begin with '.'
Note: Output will be the number of files you have in your directory

Task B: Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort).
Note: Output will be the number: 33
Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Output is this..
DARWIN CHARLES EINSTEIN ALBERT    GALILEO GALILELI    GOLDMAN EMMA    LOVELACE ADA MANDELA NELSON    PARKS ROSA    RUSSELL BERTRAND
Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.
Note: Here is what the output should look like:
moose bullwinkle 94111 franti michael 94112 marley bob 94112 richards keith 94112 simone nina 94112 einstein albert 94113 russell bertrand 94113 oliver mary 94114 hanh thichNhat 94115 kropotkin peter 94115 chomsky noam 94116 squirrel rocketJ 94122 chapman tracy 94211 marley rita 94212 black mary 94221
Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon). Hint: Cut the first part of the date command then pipe to tr. Note: Example for output would be wed if I run the command on a Wednesday Task B: Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort).
Note: Output will be the number: 33
Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Output is this..
DARWIN CHARLES EINSTEIN ALBERT    GALILEO GALILELI    GOLDMAN EMMA    LOVELACE ADA MANDELA NELSON    PARKS ROSA    RUSSELL BERTRAND
Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.
Note: Here is what the output should look like:
moose bullwinkle 94111 franti michael 94112 marley bob 94112 richards keith 94112 simone nina 94112 einstein albert 94113 russell bertrand 94113 oliver mary 94114 hanh thichNhat 94115 kropotkin peter 94115 chomsky noam 94116 squirrel rocketJ 94122 chapman tracy 94211 marley rita 94212 black mary 94221
Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon). Hint: Cut the first part of the date command then pipe to tr. Note: Example for output would be wed if I run the command on a Wednesday Task B: Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort).
Note: Output will be the number: 33
Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Output is this..
DARWIN CHARLES EINSTEIN ALBERT    GALILEO GALILELI    GOLDMAN EMMA    LOVELACE ADA MANDELA NELSON    PARKS ROSA    RUSSELL BERTRAND
Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.
Note: Here is what the output should look like:
moose bullwinkle 94111 franti michael 94112 marley bob 94112 richards keith 94112 simone nina 94112 einstein albert 94113 russell bertrand 94113 oliver mary 94114 hanh thichNhat 94115 kropotkin peter 94115 chomsky noam 94116 squirrel rocketJ 94122 chapman tracy 94211 marley rita 94212 black mary 94221
Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon). Hint: Cut the first part of the date command then pipe to tr. Note: Example for output would be wed if I run the command on a Wednesday

Explanation / Answer

NOTE: I have completed the program for your assignment. Please check and let me know if you have any questions. I will acknowledge back with a response within 24 hours. Thanks for your patience.


TaskA:
Make a one-line Unix command - using pipe(s) - to display the number of files in your home directory including the hidden files that begin with '.'
Note: Output will be the number of files you have in your directory

Ans) ls -a ~|wc -l

Explanation:
1) ls -a ~
will display all files including hidden files in home directory.
2) wc -l
once all the files including hidden files are displayed. wc -l command will get count of files.

Task B: Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort).

Note: Output will be the number:
33

Ans) Assuming the famous.dat file will have contents like below.
famous.dat
==========
moose bullwinkle 94111
franti michael 94112
marley bob 94112

The answer is : awk '{print $3}' famous.dat|sort -u

Explanation:
1) awk '{print $3}' famous.dat
will get the 3rd column from file famous.dat
2) sort -u
once third column from file is retreived, sort -u will sort the lines and get unique lines out of it.

Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Output is this..

DARWIN CHARLES
EINSTEIN ALBERT
GALILEO GALILELI
GOLDMAN EMMA
LOVELACE ADA
MANDELA NELSON
PARKS ROSA
RUSSELL BERTRAND

Ans) I dont have famous.dat file to answer this question exactly. So i am picking the famous.dat file from the next question to answer. Please provide the correct famous.dat file if this is not the answer you expect.

famous.dat file
================
moose bullwinkle 94111
franti michael 94112
marley bob 94112
richards keith 94112
simone nina 94112
einstein albert 94113
russell bertrand 94113
oliver mary 94114
hanh thichNhat 94115
kropotkin peter 94115
chomsky noam 94116
squirrel rocketJ 94122
chapman tracy 94211
marley rita 94212
black mary 94221

Unix Terminal> tail -8 famous.dat|awk '{print $1, $2}' |sort|tr '[a-z]' '[A-Z]'
BLACK MARY
CHAPMAN TRACY
CHOMSKY NOAM
HANH THICHNHAT
KROPOTKIN PETER
MARLEY RITA
OLIVER MARY
SQUIRREL ROCKETJ
Unix Terminal>

Explanation:
1) tail -8 famous.dat
to retreive data for last 8 people in the file famous.dat
2) awk '{print $1, $2}'
will get the first and second column from file famous.dat
3) sort
will sort the contents of first and second column from file in alphabetical order
4) once the contents are sorted all the lower case characters are converted to upper case using tr command.
tr '[a-z]' '[A-Z]'

Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.

Note: Here is what the output should look like:

moose bullwinkle 94111
franti michael 94112
marley bob 94112
richards keith 94112
simone nina 94112
einstein albert 94113
russell bertrand 94113
oliver mary 94114
hanh thichNhat 94115
kropotkin peter 94115
chomsky noam 94116
squirrel rocketJ 94122
chapman tracy 94211
marley rita 94212
black mary 94221

Ans)
please provide the correct famous.dat file, otherwise answering the question is difficult.


Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon). Hint: Cut the first part of the date command then pipe to tr.
Note: Example for output would be
wed
if I run the command on a Wednesday
Skip & Get next question Submit answer

Ans)
date|cut -d' ' -f1|tr '[A-Z]' '[a-z]'

Explanation:
1) date
will retreive the current day time and other details.
2) cut -d' ' -f1
will cut the first part of date which is day
3) tr '[A-Z]' '[a-z]'
converts all upper case characters of the day to lower case.

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