Sponsored Content
Top Forums Shell Programming and Scripting How to replace special characters? Post 302726213 by ken002 on Sunday 4th of November 2012 12:37:51 AM
Old 11-04-2012
Quote:
Originally Posted by ctsgnb
Code:
$ seq -f "%03g" 0 400 | while read i; do echo -e "code $i : \0$i"; done | cat -v | grep 'M-^E'
code 205 : M-^E

Looking especially for those having long sequences and filtering out those that are ending with figures:

Code:
$ seq -f "%03g" 0 400 | while read i; do echo -e "code $i : \0$i"; done | cat -v | awk 'length($0)>12&&$0!~/.*[0-9]+$/' | pr -5 -s'  ' -t
code 000 : ^@    code 177 : ^?    code 235 : M-^]    code 305 : M-E    code 343 : M-c
code 001 : ^A    code 200 : M-^@    code 236 : M-^^    code 306 : M-F    code 344 : M-d
code 002 : ^B    code 201 : M-^A    code 237 : M-^_    code 307 : M-G    code 345 : M-e
code 003 : ^C    code 202 : M-^B    code 240 : M-     code 310 : M-H    code 346 : M-f
code 004 : ^D    code 203 : M-^C    code 241 : M-!    code 311 : M-I    code 347 : M-g
code 005 : ^E    code 204 : M-^D    code 242 : M-"    code 312 : M-J    code 350 : M-h
code 006 : ^F    code 205 : M-^E    code 243 : M-#    code 313 : M-K    code 351 : M-i
code 007 : ^G    code 206 : M-^F    code 244 : M-$    code 314 : M-L    code 352 : M-j
code 010 : ^H    code 207 : M-^G    code 245 : M-%    code 315 : M-M    code 353 : M-k
code 013 : ^K    code 210 : M-^H    code 246 : M-&    code 316 : M-N    code 354 : M-l
code 014 : ^L    code 211 : M-^I    code 247 : M-'    code 317 : M-O    code 355 : M-m
code 015 : ^M    code 212 : M-^J    code 250 : M-(    code 320 : M-P    code 356 : M-n
code 016 : ^N    code 213 : M-^K    code 251 : M-)    code 321 : M-Q    code 357 : M-o
code 017 : ^O    code 214 : M-^L    code 252 : M-*    code 322 : M-R    code 360 : M-p
code 020 : ^P    code 215 : M-^M    code 253 : M-+    code 323 : M-S    code 361 : M-q
code 021 : ^Q    code 216 : M-^N    code 254 : M-,    code 324 : M-T    code 362 : M-r
code 022 : ^R    code 217 : M-^O    code 255 : M--    code 325 : M-U    code 363 : M-s
code 023 : ^S    code 220 : M-^P    code 256 : M-.    code 326 : M-V    code 364 : M-t
code 024 : ^T    code 221 : M-^Q    code 257 : M-/    code 327 : M-W    code 365 : M-u
code 025 : ^U    code 222 : M-^R    code 272 : M-:    code 330 : M-X    code 366 : M-v
code 026 : ^V    code 223 : M-^S    code 273 : M-;    code 331 : M-Y    code 367 : M-w
code 027 : ^W    code 224 : M-^T    code 274 : M-<    code 332 : M-Z    code 370 : M-x
code 030 : ^X    code 225 : M-^U    code 275 : M-=    code 333 : M-[    code 371 : M-y
code 031 : ^Y    code 226 : M-^V    code 276 : M->    code 334 : M-\    code 372 : M-z
code 032 : ^Z    code 227 : M-^W    code 277 : M-?    code 335 : M-]    code 373 : M-{
code 033 : ^[    code 230 : M-^X    code 300 : M-@    code 336 : M-^    code 374 : M-|
code 034 : ^\    code 231 : M-^Y    code 301 : M-A    code 337 : M-_    code 375 : M-}
code 035 : ^]    code 232 : M-^Z    code 302 : M-B    code 340 : M-`    code 376 : M-~
code 036 : ^^    code 233 : M-^[    code 303 : M-C    code 341 : M-a    code 377 : M-^?
code 037 : ^_    code 234 : M-^\    code 304 : M-D    code 342 : M-b    code 400 : ^@

Hi, ctsgnb,

I put filter condition chr(13), it removed ^M, but M-^E is still there , I put filter condition chr(133) (I found a char it shows octal code 205 match ascii code 133), but for somehow it doesn't work. do you have any idea which value or what kind of charactor I need to put in to filter out M-^E. I need remove these charactor in another process before generating the file.

Thanks in advance

Smilie

Last edited by ken002; 11-04-2012 at 09:19 AM..
ken002
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Replace Special characters in a file

Hi, I have a data like this in a file, 402003279034002000100147626030003300010000000000002000029000000 ær^M^\MÍW^H I need to replace those special char to some other char like # or $ Is there any ways to do it... I tried commands tr,sed and many but it was not able to replace because... (1 Reply)
Discussion started by: solai
1 Replies

2. UNIX for Dummies Questions & Answers

Find and replace special characters in a file

HI All I need a shell script ehich removes all special characters from file and converts the file to UTF-* format Specail characters to be removed must be configurable. strIllegal = @"?/><,:;""'{|\\+=-)(*&^%$#@!~`"; Please help me in getting this script as my scripting skilla are... (2 Replies)
Discussion started by: sujithchandra
2 Replies

3. Shell Programming and Scripting

Using sed to replace special characters

Hi everyone I have file1 contains: '7832' ' 8765 6543 I want a sed command that will format as: '7832' , '8765' , '6543' I tried sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2 sed -e :a -e '$!N; s/\n/ /; ta' file2 which gives: 7832 8765 6543 I need some help to continue with... (5 Replies)
Discussion started by: nimo
5 Replies

4. Solaris

How to replace special characters in vi?

Hi , I want to replace the special characters in the file. For eg: cat abc 1234/4455/acb 234/k/lll/ 234`fs`fd I want to replace / and ` with the letter a and the output should like below. How to achieve this. 1234a4455aacb 234akallla 234afsafd (2 Replies)
Discussion started by: rogerben
2 Replies

5. Shell Programming and Scripting

Replace special characters

I have a line ending with special character and 0 The special character is the field separator for this line in VI mode the file will look like below, but while cat the special character wont display i know the hexa code for the special character ^_ is \x1f and ascii code is \0037, ... (0 Replies)
Discussion started by: ratheeshjulk
0 Replies

6. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

7. Shell Programming and Scripting

Replace special characters with backslash and character

Hi, I have a string wherein i need to replace special characters with backslash and that character. Ex: If my string is a=qwerty123@!, then the new string should be a_new=qwerty123\@\!\, Thanks (3 Replies)
Discussion started by: temp_user
3 Replies

8. Shell Programming and Scripting

Help to replace the string with special characters

{"name":"alR_pl-ENVIRONMENT_192_168_211_123_sDK_PROVISION_7","description":"aLR_pl-ENVIRONMENT_192_168_211_123_sDK_PROVISION_7","json_class":"Chef::Role","default_attributes":{},"override_attributes":{"yoapp":{"jboss":"5.1.0","port":"2243","warname":"soap","datacenter":"alR","ip":"192.168.211.123","... (3 Replies)
Discussion started by: nikhil jain
3 Replies

9. UNIX for Advanced & Expert Users

How to replace special characters?

Hi Team, I have data like this. |*|.5|*|0.2|*|A.B|*| Would like to add zero (0) before the decimal point where there is no zero as |*|0.5|*|0.2|*|A.B|*| How to replace |*|. with |*|0. I tried below command which didn't work echo '|*|.5|*|0.2|*|A.B|*' | sed... (4 Replies)
Discussion started by: Ravi.K
4 Replies

10. UNIX for Beginners Questions & Answers

Replace Pattern with another that has Special Characters

Hello Team, Any help would be much appreciated for the below scenario: I have a sed command below where I am trying to replace the contents of 'old_pkey' variable with 'new_pkey' variable in a Soap request file (delete_request.txt). This works fine for regular string values, but this new_pkey... (8 Replies)
Discussion started by: ChicagoBlues
8 Replies
iconv_1250(5)						Standards, Environments, and Macros					     iconv_1250(5)

NAME
iconv_1250 - code set conversion tables for MS 1250 (Windows Latin 2) DESCRIPTION
The following code set conversions are supported: +----------------------------------------------------------------------+ | Code Set Conversions Supported | +-------------+----------+--------------+----------+-------------------+ | Code | Symbol | Target Code | Symbol | Target Output | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | ISO 8859-2 |iso2 |ISO Latin 2 | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | MS 852 |dos2 |MS-DOS Latin 2 | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | Mazovia |maz |Mazovia | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | DHN |dhn |Dom Handlowy Nauki | +-------------+----------+--------------+----------+-------------------+ CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal. MS 1250 to ISO 8859-2 For the conversion of MS 1250 to ISO 8859-2, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | ISO 8859-2 | MS 1250 | ISO 8859-2 | |24-211 | 40 |235 |273 | |212 | 251 |236 |276 | |213 | 40 |237 |274 | |214 | 246 |241 |267 | |215 | 253 |245 |241 | |216 | 256 |246-267 |40 | |217 | 254 |271 |261 | |221-231 | 40 |273 |40 | |232 | 271 |274 |245 | |233 | 40 |276 |265 | |234 | 266 |247 |365 | +---------------+----------------+----------------+---------------+ MS 1250 to MS 852 For the conversion of MS 1250 to MS 852, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | MS 852 | MS 1250 | MS 852 | |200-211 | 40 |311 |220 | |212 | 346 |312 |250 | |213 | 40 |313 |323 | |214 | 227 |314 |267 | |215 | 233 |315 |326 | |216 | 246 |316 |327 | |217 | 215 |317 |322 | |220-231 | 40 |320 |321 | |232 | 347 |321 |343 | |233 | 40 |322 |325 | |234 | 230 |323 |340 | |235 | 234 |324 |342 | |236 | 247 |325 |212 | |237 | 253 |326 |231 | |240 | 377 |327 |236 | |241 | 363 |330 |374 | |242 | 364 |331 |336 | |243 | 235 |332 |351 | |244 | 317 |333 |353 | |245 | 244 |334 |232 | |246 | 40 |335 |355 | |247 | 365 |336 |335 | |250 | 371 |337 |341 | |251 | 40 |340 |352 | |252 | 270 |341 |240 | |253 | 256 |342 |203 | |254 | 252 |343 |307 | |255 | 360 |344 |204 | |256 | 40 |345 |222 | |257 | 275 |346 |206 | |260 | 370 |347 |207 | |261 | 40 |350 |237 | |262 | 362 |351 |202 | |263 | 210 |352 |251 | |264 | 357 |353 |211 | |265-267 | 40 |354 |330 | |270 | 367 |355 |241 | |271 | 245 |356 |214 | |272 | 255 |357 |324 | |273 | 257 |360 |320 | |274 | 225 |361 |344 | |275 | 361 |362 |345 | |276 | 226 |363 |242 | |277 | 276 |364 |223 | |300 | 350 |365 |213 | |301 | 265 |366 |224 | |302 | 266 |367 |366 | |303 | 306 |370 |375 | |304 | 216 |371 |205 | |305 | 221 |372 |243 | |306 | 217 |374 |201 | |307 | 200 |375 |354 | |310 | 254 |376 |356 | +---------------+----------------+----------------+---------------+ MS 1250 to Mazovia For the conversion of MS 1250 to Mazovia, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | Mazovia | MS 1250 | Mazovia | |200-213 | 40 |310-311 |40 | |214 | 230 |312 |220 | |215-216 | 40 |313-320 |40 | |217 | 240 |321 |245 | |220-233 | 40 |322 |40 | |234 | 236 |323 |243 | |235-236 | 40 |324-325 |40 | |237 | 246 |326 |231 | |240 | 377 |327-333 |40 | |241-242 | 40 |334 |232 | |243 | 234 |335-336 |40 | |244 | 40 |337 |341 | |245 | 217 |340-341 |40 | |246-252 | 40 |342 |203 | |253 | 256 |343 |40 | |254 | 252 |344 |204 | |255-256 | 40 |345 |40 | |257 | 241 |346 |215 | |260 | 370 |347 |207 | |261 | 361 |350 |40 | |262 | 40 |351 |202 | |263 | 222 |352 |221 | |264 | 40 |353 |211 | |265 | 346 |354-355 |40 | |266 | 40 |356 |214 | |267 | 372 |357-360 |40 | |270 | 40 |361 |244 | |271 | 206 |362 |40 | |272 | 40 |363 |242 | |273 | 257 |364 |223 | |274-276 | 40 |365 |40 | |277 | 247 |366 |224 | |300-303 | 40 |367 |366 | |304 | 216 |370-373 |40 | |305 | 40 |374 |201 | |306 | 225 |375-376 |40 | |307 | 200 | | | +---------------+----------------+----------------+---------------+ MS 1250 to DHN For the conversion of MS 1250 to DHN, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | DHN | MS 1250 | DHN | |200-213 | 40 |306 |201 | |214 | 206 |307-311 |40 | |215-216 | 40 |312 |202 | |217 | 207 |313-320 |40 | |220-233 | 40 |321 |204 | |234 | 217 |322 |40 | |235-236 | 40 |323 |205 | |237 | 220 |324-325 |40 | |240 | 377 |326 |231 | |241-242 | 40 |327-333 |40 | |243 | 203 |334 |232 | |244 | 40 |335-336 |40 | |245 | 200 |337 |341 | |246-252 | 40 |340 |40 | |253 | 256 |341 |240 | |254 | 252 |342-345 |40 | |255-256 | 40 |346 |212 | |257 | 210 |347-351 |40 | |260 | 370 |352 |213 | |261 | 361 |353-354 |40 | |262 | 40 |355 |241 | |263 | 214 |356-360 |40 | |264 | 40 |361 |215 | |265 | 346 |362 |40 | |266 | 40 |363 |216 | |267 | 372 |364 |223 | |270 | 40 |365 |40 | |271 | 211 |366 |224 | |272 | 40 |367 |366 | |273 | 257 |370-371 |40 | |274-276 | 40 |372 |243 | |277 | 221 |373-376 |40 | |300-305 | 40 | | | +---------------+----------------+----------------+---------------+ FILES
/usr/lib/iconv/*.so conversion modules /usr/lib/iconv/*.t conversion tables /usr/lib/iconv/iconv_data list of conversions supported by conversion tables SEE ALSO
iconv(1), iconv(3C), iconv(5) SunOS 5.10 18 Apr 1997 iconv_1250(5)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy