Question

In: Computer Science

Can you explain the answer: thanks. who | awk ‘ { print $1 } ‘ |...

Can you explain the answer: thanks.

who | awk ‘ { print $1 } ‘ | sort –u | wc –l

ls –l | wc –l > /tmp/count

find ~username –type –d –print

person = `who | grep $1`

Solutions

Expert Solution

Here is the explanation of each commands:-

who | awk ‘ { print $1 } ‘ | sort –u | wc –l

who command is used to know current logged in user in the system.

| is a pipe special charachter which takes output from one command and uses as input in the next command

awk is a scripting language which does not requires compiling and is used for manipulating data and generating reports.

sort command is used to sort the file in a particular order.

wc command is used to count the words.

So, in the above code.

First it displays current logged in user in the system and passes the information to awk command where it 'print $1' prints first word of each logged in user. This output is then sorted and only unique entries will remain and duplicate will be removed and a sorted list will be obtained. wc -l command will then count and display number of lines.

ls –l | wc –l > /tmp/count

  ls command is used for listing the contents of the directory or list of directories.

> is a special character which is used to create/clean a file.

so in this command,

first it will list out the names of files in a directories with details of file size, modified date and time, file name , owner of the file and permissions on the file. Then the wc command will count the number of lines in the output and it will then stored in a file named count at location tmp/count.

find ~username –type –d –print

find command is used to find the usernames and prints them.

person = `who | grep $1`

This command is used to store the value of the first user found in person variable.


Related Solutions

CAN YOU EXPLAIN THE OUTPUT. awk ‘ { print $1 } ' ls –l | cut...
CAN YOU EXPLAIN THE OUTPUT. awk ‘ { print $1 } ' ls –l | cut –c57-80 > /tmp/process_names.txt who | awk ‘{print $1}‘ | sort –u | wc –l ps -ef | awk '{print $2}' person=`who | grep $1` grep ERR app.log >/tmp/errors.txt umask -S
Email 1 Subject: Awk Utility Assessment 1 File: awk-utility-assessment-1.awk Create awk commands to remove all occurrences...
Email 1 Subject: Awk Utility Assessment 1 File: awk-utility-assessment-1.awk Create awk commands to remove all occurrences of the word "PCC" from the input stream. Your output should be a copy of each input line, with the word PCC removed wherever it occurs.        Email 2 Subject: Awk Utility Assessment 2 File: awk-utility-assessment-2.awk Create awk commands to remove the first and last words from each line of the input (assume all lines contain 3 or more words). Your output should...
The awk commands to print the first and third words (with a space between) from each...
The awk commands to print the first and third words (with a space between) from each line of the input that has the substring 'cat' in the second word (assume all lines have at least three words). Note, words are fields in this case. Your output should be a copy of each input line with the substring 'cat' in the second word and also, with just the first and third words printed. A series of comments that fully describes your...
Can you explain how to calculate with TI-84 calculator if possible? Thanks will rate! 1) This...
Can you explain how to calculate with TI-84 calculator if possible? Thanks will rate! 1) This exercise uses the normal probability density function and requires the use of either technology or a table of values of the standard normal distribution. The cash operating expenses of the regional phone companies during the first half of 1994 were distributed about a mean of $29.77 per access line per month, with a standard deviation of $2.65. Company A's operating expenses were $28.00 per...
IF YOU CAN NOT COMPLETE IT ALL DO NOT ANSWER THE QUESTIONS (THANKS) Develop a tentative...
IF YOU CAN NOT COMPLETE IT ALL DO NOT ANSWER THE QUESTIONS (THANKS) Develop a tentative plan of care for a client who has bipolar disorder. Include: -Nursing Diagnosis - Assessment Data (objective and subjective ) - Goal and outcome' - Nursing Intervention - Rationale - Outcome evaluation and replanning Please type your answer do not scan thanks
Answer the questions –- Print so I can read it in PeN 1) Assume that a...
Answer the questions –- Print so I can read it in PeN 1) Assume that a solvent having more isopropanol than solvent G was used in the experiment. Predict whether dye A would migrate a smaller or larger distance in this solvent than in solvent F or G. Why? 2) TLC can be used to help identify unknown compounds. Explain how this might be accomplished using the dyes as an example. 3) READ Harris page 604-623 – define the following...
Please explain your answer. Thanks so much!! Suppose that you had to explain to a person...
Please explain your answer. Thanks so much!! Suppose that you had to explain to a person (who is not an economist) why a current account deficit must be accompanied by a financial or capital account surplus. What would you say?
Can you please explain in detail. Thanks TASK 1 Minimise atrophy of the external rotator muscles...
Can you please explain in detail. Thanks TASK 1 Minimise atrophy of the external rotator muscles at the glenohumeral joint as person recovers from injury and has restricted range of the GHJ. What exercise would you use? Type of contraction? Single or multi-joint? Open or closed kinetic chain? What strategies would you use when teaching a patient to perform this exercise who is in the cognitive phase of skill acquisition? Once fully recovered and all movement at the GHK is...
Please do not just give the answer. Please also explain how you got them. Thanks! 1....
Please do not just give the answer. Please also explain how you got them. Thanks! 1. Which of the following is not a valid method of applying LCNRV: A. logical categories of inventory (i.e. product line) B. the entire inventory C. inventory items to be sold within the next year D. individual inventory items E. None of the answer choices are correct 2. Which of the following would not require the company to account for the change retrospectively? A. From...
( please do not answer by handwriting, the answer should be in print type) Explain and...
( please do not answer by handwriting, the answer should be in print type) Explain and Discuss one process or system in the ministry of public works, where the industrial ecology mimics biological ecology.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT