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

  • Home
  • SEARCH
  • 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 400177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:55:07+00:00 2026-05-12T16:55:07+00:00

I have program output that looks like this (tab delim): $ ./mycode somefile 0000000000000000000000000000000000

  • 0

I have program output that looks like this (tab delim):

    $ ./mycode somefile 
    0000000000000000000000000000000000      238671
    0000000000000000000000000000000001      0
    0000000000000000000000000000000002      0
    0000000000000000000000000000000003      0
    0000000000000000000000000000000010      0
    0000000000000000000000000000000011      1548.81
    0000000000000000000000000000000012      0
    0000000000000000000000000000000013      937.306

What I want to do is on FIRST column only: replace 0 with A, 1 with C, 2 with G, and 3 with T.
Is there a way I can transliterate that output piped directly from “mycode”.
Yielding this:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA        238671
...
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACT        937.306
  • 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-12T16:55:07+00:00Added an answer on May 12, 2026 at 4:55 pm

    It should be possible to do it with sed, put this in a file (you can do it command-line to, with -e, just don’t forget those semicolons, or use separate -e for each line). (EDIT: Keep in mind, since your data is tab delimited, it should in fact be a tab character, not a space, in the first s//, make sure your editor doesn’t turn it into spaces)

    #!/usr/bin/sed -f
    
    h
    s/ .*$//
    y/0123/ACGT/
    G
    s/\n[0-3]*//
    

    and use

    ./mycode somefile | sed -f sedfile
    

    or chmod 755 sedfile and do

    ./mycode somefile | sedfile
    

    The steps performed are:

    1. copy buffer to hold space (replacing held content from previous line, if any)
    2. remove trailing stuff (from first space to end of line)
    3. transliterate
    4. append contents from hold space
    5. remove the newline (from the append step) and all digits following it (up to the space)

    Worked for me on your data at least.

    EDIT:
    Ah, you wanted a one-liner…

    GNU sed

    sed -e "h;s/ .*$//;y/0123/ACGT/;G;s/\n[0-3]*//"
    

    or old-school sed (no semicolons)

    sed -e h -e "s/ .*$//" -e "y/0123/ACGT/" -e G -e "s/\n[0-3]*//"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.