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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:48:52+00:00 2026-06-07T18:48:52+00:00

I’m having trouble using sed to replace non-printable characters with other non-printable characters. Specifically,

  • 0

I’m having trouble using sed to replace non-printable characters with other non-printable characters.
Specifically, I want sed to look for a line in a table starting with a TAB and ‘insert’ a BACKSPACE, essentially bringing the text from that line up to the previous line.

The reason for this is that I have a table split into columns, with some rows taking up multiple lines:

column1,row1    column2,row1,line1
                column2,row1,line2

I’d like it to end up like this (ish)

column1,row1    column2,row1,line1         column2,row1,line2

(the spacings don’t matter)

I can’t seem to manage this though. I’m unsure if the expressions \t sand \b aren’t recognized, but they don’t seem to be in the way I’ve tried. I also can’t get echo commands with octal representations of these

These are the kind of things I’ve tried:

sed 's/^\t/\b/' file.txt newfile.txt


sed 's/^(`echo "\011"`)/`echo "\010"`/' file.txt newfile.txt

Any help would be appreciated.

  • 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-07T18:48:54+00:00Added an answer on June 7, 2026 at 6:48 pm

    I wouldn’t do this with sed. Sure, it’s possible to have sed store a line in a hold buffer, then read the next line and if it starts with whitespace, pop and print the hold buffer then print the current line … but the code will look like your modem just lost carrier.

    I’d use awk.

    awk '/^[^ \t]/ && buf{print buf;buf=""} {buf=buf $0} END{print buf}' input.txt
    

    What does this do?

    • The second section, {buf=buf $0}, adds the current line to a buffer named buf.
    • Then, the first section, /^[^ \t]/ && buf{print buf;buf=""} (which is ignored for the first line because buf has not yet been set), prints buf for any line that doesn’t start with whitespace (i.e. the start of a new output line). Then it resets buf.
    • The last section, END{print buf}, prints any leftovers.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

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.