How to tell SED to emit output in 8-bit ASCII only?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to tell SED to emit output in 8-bit ASCII only?
# 1  
Old 03-29-2009
Question How to tell SED to emit output in 8-bit ASCII only?

I have to mangle some "plain ASCII" text file (i.e. 8 bits/characters where the text DOES contain characters like Umlauts and accented characters from the upper 7-bits range, i.e. with hex codes in [128..254]).

For this I am trying to use SED which I downloaded as part of cygwin package (yes, I am doing this one Windoze...).

Alas, SED emits the result using Unicode-16 characters (i.e. 16 bits/characters), which the program for which the output is intended can't handle. Can one tell SED to NOT emit Unicode-16 characters but force it to emit 8-bit characters (Unicode-8) only?
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed non ascii value remove

Hi All, i am using the below perl command to remove the non ascii value,it is working fine. we need to find the similar solution using the sed command. but i tried it is not working and getting the error. perl -pe 's/]//g' test.txt sed is not working. sed -i 's/]//g'... (11 Replies)
Discussion started by: bmk123
11 Replies

2. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies

3. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies

4. Shell Programming and Scripting

Bit of sed help in XML

Hi all, need some help seeing the bug in my SED Source XML <SMART_FOLDER JOBISN="1" SUB_APPLICATION="PMT-APB" MEMNAME="Job0" JOBNAME="PMT-APB" FOLDER_NAME="PMT-APB"> </SMART_FOLDER> My SED Command sed -e 's/\(<SMART_FOLDER \)\(.*FOLDER_NAME="PMT-APB"\)/\FOLDER_ORDER_METHOD="PCI" \2/' <... (0 Replies)
Discussion started by: J-Man
0 Replies

5. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

6. Shell Programming and Scripting

convert ascii values into ascii characters

Hi gurus, I have a file in unix with ascii values. I need to convert all the ascii values in the file to ascii characters. File contains nearly 20000 records with ascii values. (10 Replies)
Discussion started by: sandeeppvk
10 Replies

7. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies
Login or Register to Ask a Question
tr(1B)						     SunOS/BSD Compatibility Package Commands						    tr(1B)

NAME
tr - translate characters SYNOPSIS
/usr/ucb/tr [-cds] [ string1 [string2]] DESCRIPTION
The tr utility copies the standard input to the standard output with substitution or deletion of selected characters. The arguments string1 and string2 are considered sets of characters. Any input character found in string1 is mapped into the character in the corresponding posi- tion within string2. When string2 is short, it is padded to the length of string1 by duplicating its last character. In either string the notation: a-b denotes a range of characters from a to b in increasing ASCII order. The character , followed by 1, 2 or 3 octal digits stands for the character whose ASCII code is given by those digits. As with the shell, the escape character , followed by any other character, escapes any special meaning for that character. OPTIONS
Any combination of the options -c, -d, or -s may be used: -c Complement the set of characters in string1 with respect to the universe of characters whose ASCII codes are 01 through 0377 octal. -d Delete all input characters in string1. -s Squeeze all strings of repeated output characters that are in string2 to single characters. EXAMPLES
Example 1: Creating a list of all the words in a filename The following example creates a list of all the words in filename1, one per line, in filename2, where a word is taken to be a maximal string of alphabetics. The second string is quoted to protect `' from the shell. 012 is the ASCII code for NEWLINE. example% tr -cs A-Za-z '12' <filename1>filename2 ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
ed(1), ascii(5), attributes(5) NOTES
Will not handle ASCII NUL in string1 or string2. tr always deletes NUL from input. SunOS 5.10 26 Sep 1992 tr(1B)