Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6815949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:52:03+00:00 2026-05-26T20:52:03+00:00

Maybe my title cannot fully explain my intention. I have a list of data

  • 0

Maybe my title cannot fully explain my intention.
I have a list of data like below:

@HWI-ST150_0129:3:8:21208:93107#0/1
TGTCTAGTTTTTATAGGAAGATATTTCCTTTTCTACCTTTGACTTCAAAGCGGCTGAAATCTCCACTTGCAAATTCCACAAAAAGAGTGTTACAAGTCT
+
Yeeeeeeeeeceed]dddddd^YdceeeedaeeddYccccc\ddceeYeYY`[`bcYc^_XY^_]d^dd`abdddee\e\ddLb]`_`cTbbbYbaM_]
@HWI-ST150_0129:3:8:21208:93107#0/2
TTTGTAAAGTCTGCACGTGGATAACTTGACCACTTAGAGGCCTTCGTTGGAAACGGGTTTTTTTCATGTAAGGCTAGACAGAAGAATTCTCAGTAACTTCAAGTTACTGAGAATTCTTCTGTCTAGCCTTACATGAAAAAAACCCGTTTCCAACGAAGGCCTCTAAGTGGTCAAGTTATCCACGTGCAGACTTTACAAA
+
ffcaefffcdeeeeeeeeeedff^f`\\eeedaec^d^d`deaffeeTecb^bbbddadYcccW[X\MZ\XaU_UTI\]TZ]K[VQX^aIb`b`^X^YSYHWI-ST150_0129:3:8:21208:93107#0

We can see the first line and 5th line are both head/name, but ending with either #0/1 or #0/2. Now I hope to group every 4 lines, but later merge all those with #0/1 together, and #0/2 together.

Should be like:

@HWI....#0/1
TTCCGC
+
cffccc
@HWI....#0/1
CCGGGG
+
abbcgg
....

also another file is:
@HWI….#0/1
ATTCCG
+
fccfcc
@HWI….#0/1
CGCCGG
+
gbbcaa

I know how to do this with a simple python script. But just wondering if we can do only with some quite simple bash code?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:52:04+00:00Added an answer on May 26, 2026 at 8:52 pm

    sed -n '1,${p;n;n;n;}' should work for getting every 4th line:

    [ 11:32 jon@hozbox.com ~/SO/bash ]$ cat blah | sed -n '1,${p;n;n;n;}'
    @HWI-ST150_0129:3:8:21208:93107#0/1
    @HWI-ST150_0129:3:8:21208:93107#0/2
    
    [ 11:33 jon@hozbox.com ~/SO/bash ]$ cat blah
    @HWI-ST150_0129:3:8:21208:93107#0/1
    TGTCTAGTTTTTATAGGAAGATATTTCCTTTTCTACCTTTGACTTCAAAGCGGCTGAAATCTCCACTTGCAAATTCCACAAAAAGAGTGTTACAAGTCT
    +
    Yeeeeeeeeeceed]dddddd^YdceeeedaeeddYccccc\ddceeYeYY`[`bcYc^_XY^_]d^dd`abdddee\e\ddLb]`_`cTbbbYbaM_]
    @HWI-ST150_0129:3:8:21208:93107#0/2
    TTTGTAAAGTCTGCACGTGGATAACTTGACCACTTAGAGGCCTTCGTTGGAAACGGGTTTTTTTCATGTAAGGCTAGACAGAAGAATTCTCAGTAACTTCAAGTTACTGAGAATTCTTCTGTCTAGCCTTACATGAAAAAAACCCGTTTCCAACGAAGGCCTCTAAGTGGTCAAGTTATCCACGTGCAGACTTTACAAA
    +
    ffcaefffcdeeeeeeeeeedff^f`\\eeedaec^d^d`deaffeeTecb^bbbddadYcccW[X\MZ\XaU_UTI\]TZ]K[VQX^aIb`b`^X^YSYHWI-ST150_0129:3:8:21208:93107#0
    

    Useful One-Line Scripts For sed
    man sed

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

maybe the title is not very clear, let me elaborate. I have a python
Maybe an over elaborate title. Basically think of an email inbox. I have a
Maybe there is something obvious I cannot see but I think that setting data-theme
The title of this question is not very clear but I cannot explain what
Maybe I just don't know .NET well enough yet, but I have yet to
I'm sorry if I didn't explain my problem well enough in the title. In
I have a WCF service that uses ODP.NET to read data from an Oracle
What a crappy title. Maybe someone can edit it for me. Here's the scoop:
I realise that the title may be very confusing, so to explain what I
I try to have a treeview that browse potentially cyclic hierarchical data. This means

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.