Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 2
    What does your input data look like? Commented Jul 6, 2020 at 6:54
  • 3
    I bet all this could be done in a single awk program, just edit your question with input data and expected filename. Commented Jul 6, 2020 at 6:59
  • It is going to run like a dog if you append/close the output file for every line. Awk will write to at least 1000 output files concurrently, and close them automatically at end. In fact, your close() is invalid anyway: the filename is different to the one in the print. Commented Jul 6, 2020 at 9:48
  • You never need sed when you're using awk and you definitely don't need a pipleine of multiple calls to sed + awk and a UUOC to do anything. For example cat GCF_000393655.1_Nsyl_genomic.gff | awk '$3=="CDS"' | sed 's/;/\t/g' | awk '{print $1,$7,$12}' | sed 's/Name=//g' can be written as just awk '$3=="CDS"{gsub(/;/,"\t"); $0=$1 OFS $7 OFS $12; gsub(/Name/,""); print}' GCF_000393655.1_Nsyl_genomic.gff. If you edit your question to include concise, testable sample input and expected output then we can help you do whatever it is you're trying to do. Commented Jul 6, 2020 at 13:53
  • I updated the question and included the link to the input file and examples for filenames. Commented Jul 9, 2020 at 4:22