Hi,
I want to take 2 variable from different line and column. But I am new in bash because of this I couldn't do. If you help me I will be happy
Example output:
I want to take only example2 and example6
Hi,
I want to take 2 variable from different line and column. But I am new in bash because of this I couldn't do. If you help me I will be happy
Example output:
I want to take only example2 and example6
This smells like a covert homework problem, can you explain what you're trying to achieve?
Regards
No it isn't my homework. I am trying to take free ram in centOS.
total used free shared buffers cached
Mem: 248 227 20 0 34 100
-/+ buffers/cache: 93 155
Swap: 2000 105 1895
I want to take 3rd and 7th column in 2nd line. I am taking but for earch line not 2nd :(...
free -m | awk '{print $3 - $7}' | awk '{print "Free Ram: " $1}'
try something on these lines, below prints 3rd coulmn of line where MEM is found & 4th column in the line where it finds -/+.
awk '/Mem/ {print $3} /\-\/\+/ {print $4}' f�lename
Is this what you're looking for?
awk 'NR==2{print "Free ram: ", $2, $7}'
Regards
Thank you Franklin52 and brainyoung.
awk 'NR==2{print "Free ram: ", $2, $7}'
with this I solved my problem.