text: user7236: I have a FASTQ file:
  @NS500455:80:HG7TNBGXB:1:11101:17723:1055 1:N:0:ATCACG
  ACTTANGTGTATGTAAACTTCCGACTTCAACTGTATAGGGATCCNAGCTCCAATTCGCCCTATAGTGAGTCGTAT
  +
  /AAAA#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
  @NS500455:80:HG7TNBGXB:1:11101:8821:1057 1:N:0:ATCACG
  ACTTANGTGATGTAAACTTCCGACTTCAACTGTATAATAAATATCTAGATCGGAAGAGCACACGTCCGAACTCCA
  
  I want to remove the string  ACTTAAGTGTATGTAAACTTCCGACTTCAACTG from it while retaining the sequences starting from TA onwards.
  I wrote grep "ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA" SRR_1.fastq | sed "s/ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA/TA/g", but it removes the headers of the FASTQ file as well.
  The desired output would be 
  @NS500455:80:HG7TNBGXB:1:11101:17723:1055 1:N:0:ATCACG
  TATAGGGATCCNAGCTCCAATTCGCCCTATAGTGAGTCGTAT
  +
  /AAAA#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
  @NS500455:80:HG7TNBGXB:1:11101:8821:1057 1:N:0:ATCACG
  TATAATAAATATCTAGATCGGAAGAGCACACGTCCGAACTCCA
  
  How to do this. I dont want to use cutadapt.
  Kindly help.
  
  user8749: If you need the quality vector for each read, then your code will create a shift because it does not cut the quality vector. You should rather use a trimming tool a systematically cut all 33 first characters. fastp will allow you to do it easily with the -f, --trim_front1 argument.
  
  user650: Skip the grep, use just the sed. Unless the header contains the long sequence as well (which I doubt it will), your command will work.
  sed 's/^ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA/TA/' SRR_1.fastq > SRR_1.edited.fastq
  
  
  user2388: What application are you using that will be okay with a mismatching quality string?
  Use trimmomatic or cutadapt, or bcl2fastq could probably do the job too.  Those will also have the benefit of dealing properly with one-off errors, which awk and sed won't.  
  
original_text: 7236: <p>I have a FASTQ file:</p>
  
  <pre><code>@NS500455:80:HG7TNBGXB:1:11101:17723:1055 1:N:0:ATCACG
  ACTTANGTGTATGTAAACTTCCGACTTCAACTGTATAGGGATCCNAGCTCCAATTCGCCCTATAGTGAGTCGTAT
  +
  /AAAA#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
  @NS500455:80:HG7TNBGXB:1:11101:8821:1057 1:N:0:ATCACG
  ACTTANGTGATGTAAACTTCCGACTTCAACTGTATAATAAATATCTAGATCGGAAGAGCACACGTCCGAACTCCA
  </code></pre>
  
  <p>I want to remove the string  ACTTAAGTGTATGTAAACTTCCGACTTCAACTG from it while retaining the sequences starting from TA onwards.
  I wrote <code>grep "ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA" SRR_1.fastq | sed "s/ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA/TA/g"</code>, but it removes the headers of the FASTQ file as well.</p>
  
  <p>The desired output would be </p>
  
  <pre><code>@NS500455:80:HG7TNBGXB:1:11101:17723:1055 1:N:0:ATCACG
  TATAGGGATCCNAGCTCCAATTCGCCCTATAGTGAGTCGTAT
  +
  /AAAA#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE#EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
  @NS500455:80:HG7TNBGXB:1:11101:8821:1057 1:N:0:ATCACG
  TATAATAAATATCTAGATCGGAAGAGCACACGTCCGAACTCCA
  </code></pre>
  
  <p>How to do this. I dont want to use cutadapt.</p>
  
  <p>Kindly help.</p>
   8749: <p>If you need the quality vector for each read, then your code will create a shift because it does not cut the quality vector. You should rather use a trimming tool a systematically cut all 33 first characters. <strong><a href="https://github.com/OpenGene/fastp" rel="nofollow noreferrer">fastp</a></strong> will allow you to do it easily with the <code>-f, --trim_front1</code> argument.</p>
   650: <p>Skip the <code>grep</code>, use just the <code>sed</code>. Unless the header contains the long sequence as well (which I doubt it will), your command will work.</p>
  
  <pre><code>sed 's/^ACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA/TA/' SRR_1.fastq &gt; SRR_1.edited.fastq
  </code></pre>
   2388: <p>What application are you using that will be okay with a mismatching quality string?</p>
  
  <p>Use trimmomatic or cutadapt, or bcl2fastq could probably do the job too.  Those will also have the benefit of dealing properly with one-off errors, which awk and sed won't.  </p>
  