We are getting extended Ascii characters in the input file and my requirement is to search and replace them with a space. I am using the following command
It is doing a good job, but in some cases it is replacing the extended characters with two spaces. So my input file is fixed length file and because of this the length is increasing by 1 character or 2 characters depending on number of extended characters in the single line.
What is the best way to replace extended characters with only one space ?
(preferably sed command)
What we are getting at: your choice of the C locale does not "work" with the file.
So, is the file from an external source like a vendor or is it corrupted?
Because if a line has 100 bytes of characters used in a given locale, the output of your sed will be 100 bytes of data, not 101. So something is going on with the data in the file.
This uses cat as UUOC to simplify the example. You know the fixed record length of your file. For this example assume it is 100.
This should produce the answer of zero, meaning all records are the same, correct size. Try it to make sure the file not corrupt. And we are not barking up the wrong tree.
We are getting binary data from the external vendor. It is then processed using a C Program and the output is good, but occasionally we get these extended characters that too, in 1 record out of million records. So i can safely say that the file is not corrupted.
This is how the bad characters look in vi editor
The octal equivalent of the above three characters:
I am trying to develop a script which will work on a source UTF-8 file and perform one or more of the following
It will accept the target encoding as an argument e.g. US-ASCII or ISO-8859-1, etc
1. It should replace all occurrences of characters outside target character set by " " (space) or... (3 Replies)
I am working with a log file that I am trying to clean up by removing non-English ASCII characters. I am using Bash via Cygwin on Windows.
Before I start I set:
export LC_ALL=C
I clean it up by removing all non-English ASCII characters with the following command;
grep -v $''... (4 Replies)
Hi All,
I am trying to remove (SELECTIVE - passed as argument) Extended ASCII using Awk based on adhoc basis. Can you please let me know how to do it. I have to implement this using awk only.
Thanks & Regads (14 Replies)
Hi,
I want to read extended ASCII characters from keyboard using c language on unix/linux. How to read extended characters from keyboard or by copy-paste in terminal irrespective of locale set in the system. I want to read the input characters from keyboard, store it in an array or some local... (3 Replies)
Hi,
Is there a way to identify the lines in a file having extended ascii characters and display the same?
For instance I have a file abc.txt having below data
aaa|bbb|111|This is first line
aaa|bbb|222|This is secõnd line
aaa|bbb|333|This is third line
aaa|bbb|444|This is foùrth line... (3 Replies)
Hi All,
I'm trying to send extended ascii characters to my HP2055 as part of PCL printer control codes. What I want to do is select a bar code font, print the bar code and reset the printer to the default font.
Selecting the bar code font works good. Printing the bar code goes almost ok too. ... (5 Replies)
hi i would like to check text files if they contain extended ascii characters within or not. i really dont have any idea how to start your kind help would be very much appreciated thanks. (7 Replies)
Hi All,
In the HP Unix that i'm using when i initialise a string as Stalled="'30¬G'"
Stalled=$Stalled" '30¬C'", it is taking the character ¬ as a comma. I need to grep for 30¬G 30¬C in a file and take its count. But since this character ¬ is not being understood, the count returns a zero.
The... (2 Replies)
Hi all,
I would like to change the extended ascii code ( 128 - 255).
I tried to change LC_ALL and LANG in current session ( values from locale -a) and for no good.
Thanks. (0 Replies)
Greetings....
I'm looking for the command and syntax to search files, several actually, that will find the string pattern "\0;" and delete it. I have over 200 files to change :o
Thanx (2 Replies)