Question

In: Computer Science

Do not use awk. Using the fixed length field file called famous.dat, make a one-line Unix...

Do not use awk.

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

Hint:  famous.dat uses space(s) to separate the fields

Solutions

Expert Solution

Pipes:

pipes are the components in unix that are used to carry on the output on one command to the next one.

tail:

tail is used to print the specified number of rows from last of the file.

Cut:

The cut command is used to perform vertical selection of columns from the file or output that is passed on to it.

Answer:

tail -8 famous.dat | cut -d " " -f 6,35 | tr '[:lower:]' '[:upper:]'

Explaination:

In the above command,the tail command is used to select the last 8 rows from the file famous.dat

The output is passed on to the next command using pipe

The cut is used to select the first and last name fields using delimiter as spaces between the fields.

This output is passed on to the next command using pipe.

This contains the first and last names of the people.

The tr '[:lower:]' '[:upper:]'  command is used to convert the data to Upper case format.

This output is then passed on to be displayed through the terminal.

The screenshot of execution is attached below for the reference.

Screenshot:

The data file that is used to perform operations is shown.

Output:


Related Solutions

**Need to use awk command in putty (should be a ONE LINE COMMAND) Write the command...
**Need to use awk command in putty (should be a ONE LINE COMMAND) Write the command that would find all lines that have an email address and place a label email = before the line in the file longfile output will multiple lines similar to this one : using a good awk command the output would be something like this email = From: "Linder, Jann/WDC" <[email protected]> email = To: Mr Arlington Hewes <[email protected]> email = > From: Mr Arlington Hewes...
unix Delete the second character from every line in a file Delete the last word from...
unix Delete the second character from every line in a file Delete the last word from every line in a file. Swap the first and second letter of every line in a file. Swap the first and last characters of every line in a file.
On Python Preview the provided sample file called studentdata.txt. It contains one line for each student...
On Python Preview the provided sample file called studentdata.txt. It contains one line for each student in an imaginary class. The student’s name is the first thing on each line, followed by some exam scores. The number of scores might be different for each student. Using the text file studentdata.txt write a program that calculates the average grade for each student, and print out the student’s name along with their average grade with two decimal places.
Assume there is a file called "mydata". each line of the file contains two data items
how do you read in a file in JAVA Assume there is a file called "mydata". each line of the file contains two data items: hours and rate. hours is the represented by the number of hours the worker worked and rate is represented as hourly rate of pay. The first item of data is count indicating how many lines of data are to follow.Methodspay- accepts the number of hours worked and the rate of pay. returns the dollor and cents...
Using one Unix command, how to go to my home directory using tilde, ~. Using one...
Using one Unix command, how to go to my home directory using tilde, ~. Using one Unix command, how to go to your home directory using tilde, ~. Make sure you are in your home directory. Using one Unix command, how to go to your hw4 directory inside your hw directory, inside your it244directory using a relative pathname. Using one Unix command, how to go to my home directory using an absolute pathname. Using one Unix command, how to go...
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name...
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name it as “mysedfile”: Name Class1 Class2 Class3 Tom 92 94 88 Nancy 91 85 95 Lisa 99 77 96 Jerry 84 98 90 2. Please use sed command(s) to complete the following tasks. display Tom’s record. display Lisa’s record. display both Tom’s and Lisa’s records. remove the blank line(s) from “mysedfile.” replace all the digits with *.
the assignment folder for this assignment contains a file called values.txt. The first line in the...
the assignment folder for this assignment contains a file called values.txt. The first line in the file contains the total number of integers which comes after it. The length of this file will be the first line plus one lines long. Implement a MinHeap. Your program should read in input from a file, add each value to the MinHeap, then after all items are added, those values are removed from the MinHeap. Create a java class called MinHeap with the...
using access, how do you create a table with a field called discount where 1=5% and...
using access, how do you create a table with a field called discount where 1=5% and 2=6%? screenshot how to steps with microsoft access
Using Python create a script called create_notes_drs.py. In the file, define and call a function called...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following: Creates a directory called CyberSecurity-Notes in the current working directory Within the CyberSecurity-Notes directory, creates 24 sub-directories (sub-folders), called Week 1, Week 2, Week 3, and so on until up through Week 24 Within each week directory, create 3 sub-directories, called Day 1, Day 2, and Day 3 Bonus Challenge: Add a conditional statement to abort the script if...
Write a MATLAB script file to integrate  using trapezoid method (do not use trapz command for this...
Write a MATLAB script file to integrate  using trapezoid method (do not use trapz command for this part, write your own script). Consider x=-0.5 to 3 with Δt=0.01, and compare your result with using “integral” and "trapz" commands (all in one file).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT