I am trying to edit fastq.gz compressed text files by deleting the first six characters of lines 2,6,10,14 ... I have two different ways to do this right now using awk or sed, but they only work if files are unpacked. I would like to edit the files without unpacking them, and tried the following code without making it work. Thank.
Using sed:
zcat /dir/* | sed -i~ '2~4s/^.\{6\}//'
Using awk:
zcat /dir/* | awk 'NR%4==2 {gsub(/^....../,"")} 1'
source
share