Question

do the following on a UNIX command line, if applicable vi editor may be used Consider...

do the following on a UNIX command line, if applicable vi editor may be used

Consider the text file PEOPLE

101:Alice:Peters: President
102:Bob:Smith: VP
103:Jane:Jones: Programmer
104:John:Roberts: Project Manager

1. use the cut command to display the first name and last name only

2. using cut and sort commans and a pipe display the last name and job title in each record then sort the output by the last name

3. sort the file by employee ID in decreasing order. Make sure sort treats this field as a numeric field

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)cut -d ":" -f 2-3 people.txt

-d is delimiter of ':' -f is the fields and 2-3 gives columns 2 to 3


b)cut -d ":" -f 3-4 people.txt | sort -k 1

sort takes input from cut command output and -k represents on which field sorting should be done

c)cut -d ":" -f 1-4 people.txt | sort -nr -k 1n

Here -n is used to perform numeric sorting

r is for decreasing order

-k is for field number

Add a comment
Know the answer?
Add Answer to:
do the following on a UNIX command line, if applicable vi editor may be used Consider...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How do I do the following on a Unix Command Line Prompt: Change you command-line prompt...

    How do I do the following on a Unix Command Line Prompt: Change you command-line prompt to some interesting phrase/word of your choice Change the command-line prompt to display your user name and your current working directory (this includes your interesting phrase/word) Create a short alias for “ls -l -a”, it is up to you, but maybe “lsa” Execute the “who” command together with the “grep” command to identify whether your peer group (or any 3 or more people) are...

  • JAVA DATA STRUCTURES Write a line-based text editor. The command syntax is similar to the Unix...

    JAVA DATA STRUCTURES Write a line-based text editor. The command syntax is similar to the Unix line editor ed. The internal copy of the file is maintained as a linked list of lines. To be able to go up and down in the file, you have to maintain a doubly linked list. Most commands are represented by a one-character string. Some are two characters and require an argument (or two). Support the commands shown below: Command Function Go to the...

  • QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A....

    QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A. List all files and directories recursively starting from / B. List a file names * in / C. List all files in / directory D. List all files and directories in / directory QUESTION 2 Which command is used to extract a column/field from a text file / input. A. paste B. get C. cut D. tar QUESTION 3 Which command creates an empty...

  • Create a file with the following information called presidents, using vi or pico, and again press the [tab] key between...

    Create a file with the following information called presidents, using vi or pico, and again press the [tab] key between fields. Once again, make sure you include the line numbers (6,7,8, etc) 6 Abe Lincoln honest 7 James Munroe doctrine 8 Harry Truman buck.stops 9 James Madison civil.war 10 Jimmy Carter peanuts Append presidents to people using cat, call the new file peopletwo. Enter the command used to do the append:__________________________________ Remove the line numbers and the first tab stop,...

  • This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName...

    This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName ContactName Address City PostalCode Search O ASC DESC List All Records Insert Record Country List City CustomerName ContactName Address City PostalCode Country List City Find by IID Find Insert 1 <! DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http:L 3-<head> 4 Kmeta http-equiv-"Content-Type" content-"text/html; charset-utf-8" />...

  • Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be...

    Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book tit le, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an...

  • Don't attempt if you can't attempt fully, i will dislike and negative comments would be given...

    Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...

  • I need help with this program c++ - console aplication The attached file is a list...

    I need help with this program c++ - console aplication The attached file is a list of all the Long Island Railroad stations. Each station is described on one line with six space-delimited fields. Each station has a unique 3-character numeric ID, a station name, a branch to which it belongs, a list of the IDs of other stations to which it connects, the station's longitude and latitude, and a final field describing the source of the information. Write a...

  • All the required files are attached to this question here in the form of images. Please refer the attached images and answer the questions. List the names and codes of vendors and the number of produ...

    All the required files are attached to this question here in the form of images. Please refer the attached images and answer the questions. List the names and codes of vendors and the number of products each vendor has supplied, i.e. vendor AA has supplied xxx products, and vendor BB has supplied yyy products etc. Show the total value of invoices for each customer with the customer the Last Name, and a column heading showing ‘Total_invoice_value’ in the results. List...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT