Question

What unix / linux command would I use to execute this: Display only the fifth field...

What unix / linux command would I use to execute this:

Display only the fifth field on each line in the file myclass using a delimiter of :

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

The command is:

$cut -d ':' -f 5 [filename]

Cut command prints the selected parts of lines from each file to standard output.

-d indicates the delimiter, in our case the delimiter is ":" and -f expects the field number of the file, in our case it is fifth field. And finally you've to give the file name as an argument.

Command execution:

root@ubuntu:/home/pass/Desktop# cut -d : -f 5 StrepList.txt in here. 23231 sorry linux root@ubuntu:/home/pass/Desktop# 1

Here 'StrepList.txt' is the file name and the contetns of the file are:

StrepList.txt * 1.sh x There are:no: boys:in: the: row no: one:is:innocent:here. 4123:5341:5341:523412:23231:12313. row:rando

Add a comment
Know the answer?
Add Answer to:
What unix / linux command would I use to execute this: Display only the fifth field...
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
  • 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....

  • 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...

  • UNIX/LINUX: Read the man page for tcpdump and provide the command and accompanying options required to...

    UNIX/LINUX: Read the man page for tcpdump and provide the command and accompanying options required to read the file named /tmp/tcpdump.dmp, suppress name resolution (avoid DNS lookups), and print each packet in both hex and ASCII. Please only respond if you know the answer.

  • Write a linux command that will add a "#" character to the start of every line...

    Write a linux command that will add a "#" character to the start of every line that does not already start with a "#" character. Write a linux command that will append all lines of the /etc/passwd file that contain the word "STUDENT" to the end of the file. Write a linux command that will move the last word of each line to the start of the line. Write a linux command that will add the line number to the...

  • 1) Write a Unix command that will display the message below using echo and the value...

    1) Write a Unix command that will display the message below using echo and the value of your environment variable instead of the sample student login /students/astud01 My home directory is /students/astude01 2) Write a Unix command to display your login and the system date with both commands on one line (the output may be on separate lines) SAMPLE OUTPUT (details will differ): cconner Tue Jul 7 15:38:44 PDT 2015 3) 1.Write a Unix command that will redirect (>) the...

  • Using Kali Linux, the Windows Linux Sub-System, or another Debian based Linux distribution, perform the following...

    Using Kali Linux, the Windows Linux Sub-System, or another Debian based Linux distribution, perform the following tasks based on the Linux Fundamentals lecture. For this lab, take screenshots for all major steps completed to illustrate that each task was successfully completed the same method as would be used for other labs). Tasks: 1. Create a new user named Billy Bob using the command linter face 2. Add Billy Bob to the sudoers group 3. Update and upgrade your Linux distribution...

  • 19. UNIX/Linux normally include two editors: vi and (choose the single best answer). 20. You can...

    19. UNIX/Linux normally include two editors: vi and (choose the single best answer). 20. You can use thecommand to create empty a create b. make c touch d mu 21. Which command can be used to leave vi temporarily to access the command line? 22 If you execute the contents of filel are sorted and the results are stored in file2. a sort file1 -ofile2 b. sort file1 >file2 c sort filel -d file2 d sort filel filez field or...

  • In UNIX if a file named "dimensions" contains fields separated by colons : What commands would...

    In UNIX if a file named "dimensions" contains fields separated by colons : What commands would you use to display the third field followed by the fifth?

  • Execute the following UNIX commands and paste the results in a text editor like Microsoft Word...

    Execute the following UNIX commands and paste the results in a text editor like Microsoft Word Create a directory using “mkdir” and name the directory “test” Change directory to test In the test directory, create a file using nano and name the file “NewDoc.c” Use “cd ..” Execute “ls” Create a file “temp.c” using nano Delete “temp.c” using the “rm” command. Execute each command in the question, copy and paste the result from the terminal window into Microsoft word or...

  • You are required to write a C program on Unix/Linux in which the parent process creates...

    You are required to write a C program on Unix/Linux in which the parent process creates three child processes, lets them run concurrently, and waits for them to return and prints their exit status. The three child processes are assigned different tasks. Child one is to calculate and display the highest mark of a class of ten students for a unit. Child one is required to get the marks from the standard input (i.e. the keyboard). Child two is to...

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