I want a solution for the general case (N folder)
I'm using awk to process a file and extract its content and put it in a variable then echo it:
This is the file:
H1 H2 H3 H4 H5 H6 H7 H8 H9
not important
not
not
This is the code:
$value1=awk '/H1/ { print $1}' file
$value2=awk '/H1/ { print $2}' file
$value3=awk '/H1/ { print $3}' file
echo $value1
echo $value2
echo $value3
I get the result:
H1
H2
H3
My question if I have multiple files with the same format (not the exact content, the same format) with the file and which is located in different folders but the same name:
/folder1
file
/folder2
file
/folder3
file
How can I echo the first 3 values of the H1 line but from each file in those folders so I get 9 results?
paste f1.txt f2.txt f3.txt |awk {'blah blah'}