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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:50:04+00:00 2026-05-26T11:50:04+00:00

Need a solution similar to this post ( Find and replace a particular term

  • 0

Need a solution similar to this post (Find and replace a particular term in multiple files) but for a punctuation character replacement in the first column of each delimited tab text file.

Example:

file1.txt
afile2.txt
3file.txt
...

all other file names end with .txt

Format of txt files has a “tab” in between column and look like:

aaaa:bbb    second_column    third_column
w:xyz    another_second_column    another_third_column

I need to replace the : in the first column to another character such as ##.

Please help.

Does perl treat the : character as a column cutter?

  • 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-26T11:50:05+00:00Added an answer on May 26, 2026 at 11:50 am

    Replace inplace the first colon in the first tab-delimited column in a line by ##:

    perl -i.bak -pe's/^([^\t:]*):/$1##/' *.txt
    

    It processes all .txt-files in the current directory saving backup versions to .bak-files.

    Here’s a variant that doesn’t require the capture (suggested by @Brad Gilbert in the comments):

    perl -i.bak -pe's/^[^\t:]*\K:/##/' *.txt
    

    Both scripts produce the same result.

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

Sidebar

Related Questions

The Solution I used Bruno's post to find the solution, but feel that it
This is similar to the problem posted here , but that solution doesn't work
I'm trying to find a solution similar to http://www.tenstreet.com . I've tried looking around
I would guess this is a semi-common question but I can't find it in
I do apologize if this post is a duplicate, but I haven't found anything
My question is similar to this one , but is different enough that I
I did do some googling and searching on this site but did not find
I asked a similar question earlier and we came down to this CSS solution
I need a solution to export a dataset to an excel file without any
I need a solution to read raw binary from any filetype stored on a

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.