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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:14:43+00:00 2026-06-12T15:14:43+00:00

I am writing a script to read a file and replace some characters which

  • 0

I am writing a script to read a file and replace some characters which includes unrecognized characters like

"^H^H^H^H^H^H^H^H^H"

Actually this file was generated by redirecting the console output of a telnet session. I want to remove this character. I have to remove “–More—“ from the file.

I gave a try on replacing them using

set fileID [open "bar" r]
set temp [open "temp.txt" w+]
while {[eof $fileID] != 1} {
    gets $fileID lineInfo
    regsub -all "More" $lineInfo "" lineInfo
    regsub -all "--More--" $lineInfo "" lineInfo  #This is not working
    puts $temp $lineInfo
}

I can remove “More”, but i am not able to remove “–More–“. Can anybody explain this ?

I also tried like

regsub -all "^H^H^H^H^H^H^H^H^H" $lineInfo "" lineInfo  #This is also not working

This also not working.

Thanks in advance.

  • 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-12T15:14:44+00:00Added an answer on June 12, 2026 at 3:14 pm

    I would recomment to use the :print: character class in your regex to match all “sensible” characters — refer to the re_syntax manual page.

    The resulting call to regsub should replace all non-printable characters with empty strings, so we use a negated character class (via ^), and so the proper incantation would look like this:

    set lineInfo [regsub -all {[^[:print:]]} $lineInfo ""]
    

    As to removing “–More–“” — I have two hypotheses:

    • regsub is confused treating --More-- as a switch as it starts with a dash. This can be easily fixed by passing -- to regsub after all the switches — see the manual page.
    • Your “–More–” as it appears in the file is not really a solid string, and it has certain non-printable characters embedded into it. The usual approach to debugging such situations is inspecting the file usina a HEX-dumper like xxd or a HEX-editor/viewer.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a bash script in which I read single characters from the input.
I'm writing script in remote.ini The script looks like on 1:start:{ server some.irc.server server
Hey guys, I'm writing a script to update status log, this involves frequently file
I am writing a shell script that reads a properties file & perfroms some
I'm writing a python script to replace strings from a each text file in
I am writing Perl script. In that I have to read log4j.xml file from
I am writing a Perl script which needs to perform some validations. I have
I am writing a shell script which will read a user input and do
I am writing a simple little script to read an xml file and print
I am writing a macro script in 3 steps: read an excel file by

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.