Hi,
I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this:
Name =A
xxxxxx
yyyyyy
zzzzzz
aaaaaa
bbbbbb
Value = 57
This is necessary because in a file there are written more lines which contains a string "Value =[...]"
Next, I want to get the value 57 and assign it to a variable (this is an example because each file has different value)
I tried to use this command:
VALUE=`sed -n '/Name = A/,/Value =/p' $file | tail -1 | gawk '{printf $3"\n"}'`
Unfortunately, this command runs very slow for 80 files.
I tried also to use this command:
VALUE=`sed -n '/Name = A/{n;n;n;n;n;n;s/\(.*\)= //;p;}'`
However, I'd rather not define the amount of lines which should be skipped because it is possible to insert a newline in that file and in this case the script won't work.
Can anyone help me with this?
Thanks