Originally Posted by Alkass
I want to do this
read a files's specific line but return as argument only part of it ie
value # this is mass
value2 # this is force
so, how can I get / use the $value and $value2 as arguments for some other file and skip the rest of the line(s) ? of course, the values are different everytime, but the comment always the same, as well as the position of the lines in the file
Thanks in advance
Are you doing this from the shell? is that shell bash?
Grep is the easy way to get the lines. If these are the only lines that contain the words mass and force, grep for that. If they are the only lines which contain value and value2, grep for that.
If not, you'll have to rely on the line number e.g. if it is the 3rd line use 'tail -n +3 yourfilename |head -1'.
Once you have the line you need, you can probably use cut to get what you want. E.g. cut -f 2 -d ' '