last day (15 days later) » 

11:46
0
A: Match the column heading and print the vaules of the column using awk

jcbermuCreate a script for example called script.sh with this: column=$1 to_remove="C-" column1=${column#$to_remove} awk -v column=$column1 '{print $column}' file Where file is the file with the 8 columns of data. If you issue script.sh C-8 then the result will be: C-8 30 21 67

Thanks for the solution, it works perfectly. Can you please explain what "column=${column:(-1)}" is working.
Takes the last character of variable column
I made a change to use the *title column` instead of a number
This works fine if the column numbers are matching what if the column numbers does not match and column name are some text like name, Rollno, this script will not work in that case.
If there is not maching, it shows nothing. If text on column is like Rollno for example, change variable to_remove on the script.
This is not working, I am getting complete table as the output.
11:46
Hello.
Can you tell me how are the titles of the columns?
ok
finally I am in
Ok
Can you tell me how are the titles of the columns?
CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
all 3.51 0.02 0.27 0.25 0.01 0.06 0.00 95.87 364.36
Now I understand that there are no numbers on the titles.
11:58
Ok. Ill try to solve it
just for easy understanding I used the numbers
thanks
12:26
hi
any inputs
 
1 hour later…
13:33
It's done. I changed it on the answer.
thanks
it worked
Great!!!

last day (15 days later) »