1

Problem with writing to output - awk, echo

view story
linux-howto

http://www.unix.com – Hello all, I wrote this command line for some calculation on my given input files based on another input file which is a txt file. Code: while read BAM REGION;  do samtools view $BAM $REGION | awk '{if ($2==0) print $0}' | wc -l  >>log.txt; echo "$REGION"; done >> log.txt <regions.txt It takes each file and parse it and with wc -l I want to count the number of lines and writing to output file. My problem is that it writes $REGION and calculation of samtools in separate lines. It gives me the output like this: calc1region1calc2region2calc3reg (HowTos)