Skip to content

Instantly share code, notes, and snippets.

@stianlagstad
Created February 3, 2016 12:23
Show Gist options
  • Save stianlagstad/d009961e0eda737b3126 to your computer and use it in GitHub Desktop.
Save stianlagstad/d009961e0eda737b3126 to your computer and use it in GitHub Desktop.
Extract specific sequences from a fastq file with this bash oneliner
egrep -A 3 '@readid1|readid2|readid3' reads.fastq | sed '/^--$/d'
@stianlagstad
Copy link
Author

-A 3 fetches the matching line and the next three lines.
sed '/^--$/d' will remove the "--" separator lines added automatically by using the -A parameter with egrep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment