I'm trying to run this linux command which converts a sam file to fastq reads file and works on the command line to work from a perl script (the sam to fastq tool I found does not work in this instance hence why using the command line) but I think I'm having some issues getting the perl version to work:
cat A.sam | grep -v ^@ | awk '{print "@"$1"\n"$10"\n+\n"$11}' > A.fastq
system("cat $SAMdata[$i].sam | grep -v ^\@ | awk \'{print \"\@\"\$1\"\n\"\$10\"\n+\n\"\$11}\' > $SAMdata[$i].fastq ") == 0 or die "system convert sam to Fastq: $?";
I've been staring at this for a while and can't get it to work and tried a few things but I think I'm missing something obvious, so hopefully someone will see the mistake that I'm missing which I can correct?
just corrected the escaping $ plus a few others but now got this error:
I'll have a go a just awk.
worked it out, need to escape
\n
so\\n
and for}
instead\}
Thanks for the input it helped me to think