[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2129
  • Last Modified:

How to use sed to replace a nonprinting character (ascii 1) in a text file

I am trying to replace a regularly occurring nonprinting character (ascii value 001) in a large text file. I would like to use sed, but I can't find a way to refer to a nonprinting character in the search tag. Can one use nonprinting characters in regular expressions?
Thanks.
nr-26nov07-deflines-RAW-part.txt
0
migil
Asked:
migil
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi migil,

Different versions of sed work differently, so you might have to experiment, but this will work with some seds:

  sed 's/[\x01]//g' old > new

That will delete the 01 characters.  If you want to replace them, just enter the new value between the second and third '/'.


Good Luck,
Kent
0
 
migilAuthor Commented:
Thanks Kent,
It was cygwin sed on Win2k.
I suspected something like your suggestion, but could find no documentataion...
Best wishes,
mike
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now