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 8621291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:47:15+00:00 2026-06-12T06:47:15+00:00

I have data like this in tab separated columns: 1 name1 attribute1 1 name1

  • 0

I have data like this in tab separated columns:

1   name1   attribute1
1   name1   attribute2
1   name1   attribute3
31  name2   attribute1
31  name2   attribute2
31  name2   attribute3
444 name3   attribute1
444 name3   attribute2
444 name3   attribute3

And I want to have it like this:

001 name1   attribute1
001 name1   attribute2
001 name1   attribute3
031 name2   attribute1
031 name2   attribute2
031 name2   attribute3
444 name3   attribute1
444 name3   attribute2
444 name3   attribute3

Can I do this in unix or perl for instance?

  • 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-06-12T06:47:16+00:00Added an answer on June 12, 2026 at 6:47 am
    perl -i~ -pe's/^(\d+)/sprintf "%03d", $1/e' file
    

    Actually, the above checks more than it needs to. Here’s a more general solution:

    perl -i~ -pe's/^([^\t]*)/sprintf "%03s", $1/e' file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input data with three columns (tab separated) like this: a mrna_185598_SGL
I have data in this format (tab separated columns)... Name_00001 Annotation_1 gene 329412 330509
I have a datafile (tab separated) which looks like this: chr1 38045559 38046059 chr1:38045559-38046559_NM_001142726_C1orf122_+,chr1:38045559-38046559_NM_198446_C1orf122_+,chr1:38045952-38046952_NM_024640_YRDC_-
Suppose I have a tab delimited file containing user activity data formatted like this:
I have table which looks like this (tab separated): Ron Rob rock bammy m
I have an ASCII file that contains tab-delimited data like this: Test_Version=2.5.3 Model-Manufacturer=D12-500 Test_Version=2.5.3
I have data like this: Team | goal a | 5 b | 8
Say I have data like this: <option value=abc >Test - 123</option> <option value=def >Test
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
I have MYSQL data like this id | number 1 | 3 4 |

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.