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 H9not importantnotnotThis is the code:$value1=awk '/H1/ { print $1}' file$value2=awk '/H1/ { print $2}' file$value3=awk '/H1/ { print $3}' fileecho $value1echo $value2echo $value3I get the result:H1H2H3My 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:/folder1file/folder2file/folder3fileHow can I echo the first 3 values of the H1 line but from each file in those folders so I get 9 results?
How to use awk through multiple files?
text processing;awk
I wonder whether youre leaving something out of the question,because you seem to be doing more work than you need tofor what you say you want to do. If Im understanding you correctly.If all you want to do is output (echo) the first three fields (values)from the line in the file that contains H1 (assuming that there is only one such line),all you need to do isawk '/H1/ { print $1, $2, $3 }' input_fileor, if you want the values on three separate lines,awk '/H1/ { print $1; print $2; print $3 }' input_fileTo achieve the same result for multiple files, just list their names,for example, using brace expansion:awk '/H1/ { print $1; print $2; print $3 }' /folder{1,2,3}/fileor use a wildcard, as the other answers suggested:awk '/H1/ { print $1; print $2; print $3 }' /folder?/fileIf you require that the values be assigned to variables,so you can manipulate them in your script,you need to explain your requirements more clearly.