I have some paired-end sequencing data in a directory:
sam1_R1.fastq.gz
sam1_R2.fastq.gz
sam2_R1.fastq.gz
sam2_R2.fastq.gz
I want to generate txt files as follow (for each sample (sam) separately:
$less sam1.txt
(dir)/sam1_R1.fastq.gz
(dir)/sam1_R2.fastq.gz
$less sam2.txt
(dir)/sam2_R1.fastq.gz
(dir)/sam2_R2.fastq.gz
what's the difference between the two dirs ? may be you wanted
sam2_...
Sorry! it was a typo!
try this:
assuming that dir in OP is parent directory and files share the same pattern as in OP.
What does this do, cpad? It seems to be just a
cd .. && ls *R1.fastq.gz ** cd dir
. OP seems to want each a list of sample's fastq files in separate text files.it would print: <parent_directory>/filename (for eg. test/sam1_R1.fastq.gz, test/sam1_R2.fastq.gz ....so on, assuming that test being parent directory). @ RamRS
output would look like this (on dummy .fq files in a directory named "test"):
OK, but this is not what OP wants at all. It actually leads them down a slightly wrong path.
is this OP wants? :
or
try this with awk:
I think that's close to what they want. I also think we should not be investing so much effort into a pure shell question that the OP has already solved.