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
RTRIM(3)								 1								  RTRIM(3)

rtrim - Strip whitespace (or other characters) from the end of a string

SYNOPSIS
string rtrim (string $str, [string $character_mask]) DESCRIPTION
This function returns a string with whitespace stripped from the end of $str. Without the second parameter, rtrim(3) will strip these characters: o " " (ASCII 32 ( 0x20)), an ordinary space. o " " (ASCII 9 ( 0x09)), a tab. o " " (ASCII 10 ( 0x0A)), a new line (line feed). o " " (ASCII 13 ( 0x0D)), a carriage return. o "" (ASCII 0 ( 0x00)), the NULL-byte. o "x0B" (ASCII 11 ( 0x0B)), a vertical tab. PARAMETERS
o $str - The input string. o $character_mask - You can also specify the characters you want to strip, by means of the $character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters. RETURN VALUES
Returns the modified string. EXAMPLES
Example #1 Usage example of rtrim(3) <?php $text = " These are a few words :) ... "; $binary = "x09Example stringx0A"; $hello = "Hello World"; var_dump($text, $binary, $hello); print " "; $trimmed = rtrim($text); var_dump($trimmed); $trimmed = rtrim($text, " ."); var_dump($trimmed); $trimmed = rtrim($hello, "Hdle"); var_dump($trimmed); // trim the ASCII control characters at the end of $binary // (from 0 to 31 inclusive) $clean = rtrim($binary, "x00..x1F"); var_dump($clean); ?> The above example will output: string(32) " These are a few words :) ... " string(16) " Example string " string(11) "Hello World" string(30) " These are a few words :) ..." string(26) " These are a few words :)" string(9) "Hello Wor" string(15) " Example string" SEE ALSO
trim(3), ltrim(3). PHP Documentation Group RTRIM(3)