Question

In: Computer Science

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

Solutions

Expert Solution

1.awk '{print $1}'

Prints first field or column of the given file

2.ls –l | cut –c57-80 > /tmp/process_names.txt

output of ls -l (long listing of file) is given to the input to the command cut, which extract characters starting from 57 to 80

Note:'|' is pipe operator which pass output of one command as the input to another command

Those extracted 24 characters are stored into the file /tmp/process_names.txt using output redirection operator(>)

3. who | awk ‘{print $1}‘ | sort –u | wc –l ps -ef | awk '{print $2}' person=`who | grep $1`

who command displays a list of users who are currently logged into the computer, it is passed to the command awk ‘{print $1}‘ , which print the first column(username)

sort -u sort and remove duplicates of username

wc -l print no of lines in the information about all accessible processes returned by the command ps -ef,

4. grep ERR app.log >/tmp/errors.txt

grep command select all lines containing the pattern "ERR" from app.log and that is stored in /tmp/errors.txt using output redirection operator(>)

5. umask -S

display current mask symbolically


Related Solutions

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`
in java Write a program that will print the following output 1 1 2 1 1...
in java Write a program that will print the following output 1 1 2 1 1 2 4 2 1 1 2 4 8 4 2 1 1 2 4 8 16 8 4 2 1 1 2 4 8 16 32 18 8 4 2 1
What does this program output (make sure you can explain why the output is what it...
What does this program output (make sure you can explain why the output is what it is) #include <iostream> using namespace std; class A {    int i; public:    A() {cout << "A()\n" ;}    A(int x) :i(x) {cout << "A(int)\n" ;}    A(const A& a) : i(a.i) {cout << "A(const A&)\n" ;}    ~A() {cout << "A()\n" ;} }; class B {    A a; public:    B() {cout << "B()\n" ;}    B(int x) :a(x) {cout <<...
arduino programing Question 1: write an APL program that will print the following output on the...
arduino programing Question 1: write an APL program that will print the following output on the serial monitor 10 times only.   Output:  1 2 3 4 5 Question 2: write an APL program that will turn the traffic lights on and off by taking input from the Serial port working at 11500 bits processing rate. Use r or R for RED LIGHTS, y or Y for YELLOW LIGHTS and g or G for GREEN LIGHTS.    Question 3: write an APL...
Your code must print all the steps in the output as an Eg> When you run...
Your code must print all the steps in the output as an Eg> When you run your Merge sort code the sequence of output should be: 1) Enter input sequence 2) Show n/2 division of the input sequence 3) keep showing n/2 division of your sequence until you get one attribute 4) Sort first two numbers 5) Make a stack of 4 by merging 2 * 2 and sort them 6) keep showing merging and sorting until you show the...
Suppose you have a wire of length L. You cut a length x to make a square and use the remaining
Suppose you have a wire of length L. You cut a length x to make a square and use the remaining length L - x to make a circle. Use MuPAD to find the length x that maximizes the sum of the areas enclosed by the square and the circle.
A firm produces output according to the following function: q = f (L, K) = L^1/2...
A firm produces output according to the following function: q = f (L, K) = L^1/2 K^1/4 . The cost of labor is $8 per hour and the rental cost of capital is $2 per hour. a. Determine the returns to scale for this function. b. Suppose the firm wishes to produce at cost $96. How much capital and how much labor does the firm employ? c. Derive the short-run cost function with optimal amount of K from part b....
Print out the following output. You must use exactly 2 for statements, 2 range statements, and...
Print out the following output. You must use exactly 2 for statements, 2 range statements, and 3 print statements. (python) Calculating x ** 1 1 3 5 ==== Calculating x ** 2 1 9 25 ==== Calculating x ** 3 1 27 125 ====
Can you give me a list of some ideas on how I can cut costs in...
Can you give me a list of some ideas on how I can cut costs in order to try and stay within a budget? I need a 175 word count please. Thank you very much for your time and effort.
Please print so I can read clearly. Thank you 1. Describe the effects of aging on...
Please print so I can read clearly. Thank you 1. Describe the effects of aging on fluid and electrolyte regulation. 2. Electrolytes to investigate: (Sodium, Potassium, Calcium, Magnesium). Include causation, clinical manifestations, and nursing interventions.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT