Replace new lines with spaces using awk
2
votes
5
answers
1499
views
I have a text file that I generated of all files in a directory. I'd like to use this file as input into a script that I have, but I need the text file to be formatted in a particular way to be parsed correctly.
Currently the text file, which is a list of file names, is formatted like so:
A1_R1.fastq.gz
A1_R2.fastq.gz
A2_R1.fastq.gz
A2_R2.fastq.gz
A3_R1.fastq.gz
A3_R2.fastq.gz
I need the paired reads (files with the same name, but different RN
values) for each sample to be on the same line, separated by a tab:
A1_R1.fastq.gz A1_R2.fastq.gz
A2_R1.fastq.gz A2_R2.fastq.gz
A3_R1.fastq.gz A3_R2.fastq.gz
Since I have >1000 entries, I am hoping for a method using awk or something similar to modify the file, but I don't have much experience with awk.
Asked by lovelyrubbish
(29 rep)
Feb 26, 2024, 01:43 AM
Last activity: Feb 28, 2024, 03:43 PM
Last activity: Feb 28, 2024, 03:43 PM