I work with bash script .I want get value 89 from this line
var_val --------- 89 (1 row)
Can anybody help me?
I work with bash script .I want get value 89 from this line
var_val --------- 89 (1 row)
Can anybody help me?
Assuming that the line is the only line in file inputFile
(you did say "1 row"):
1) Assign to a variable
thevalue=`awk '{print $3}' < inputFile`
2) Echo to screen:
awk '{print $3}`
Of course I am making all kinds of assumptions about the general nature of the string - is it always "the third word" you want, is it always "the only line in the file", etc.
Cut command should work:
cut -d " " -f3 inFile
To assign this value to a shell variable:
val=$(cut -d " " -f3 inFile)