bash - How to read from multiple files in one loop? -
i need read multiple file in 1 loop. have 1 file x coords, 1 file y coords , 1 file chard on coords...
for use paste put these files , in while loop use cut separate them this:
cat $file | while -r line; y=$(echo "$line" | cut -d\ -f1) x=$(echo "$line" | cut -d\ -f2) char=$(echo "$line" | cut -d\ -f3) done but problem it's slow (calling cut again , again)..
how should have in each loop proper values in $y, $x , $char while speeding things up?
thanks in advance ^_^
i'm not sure how without paste, can avoid cut assigning variables in 1 read:
while read -r x y char; echo "x = $x; y = $y; char = $char"; done < "$file"
Comments
Post a Comment