Hi all,
Need to find and replace characters like
+<89> to a
+<84> to u
When i do
perl -pi -e 's/+<89>/a/g'
its not working...when i want to search in vi editor with
:/+<89>
Can someone help...
Hi all,
Need to find and replace characters like
+<89> to a
+<84> to u
When i do
perl -pi -e 's/+<89>/a/g'
its not working...when i want to search in vi editor with
:/+<89>
Can someone help...
Escape meta-character and try:
perl -pi -e 's/\+<89>/a/g'
its not working ....tried it already
any other way....just struck on this issue
In vi the command:
:/+<89>
will take you to the next place in the file where that string occurs. The command:
:g/+<89>/s//a/g
will change every occurrence of that string to "a" in the current buffer. (You will then need to write it back to your input file or another file before exiting if you want to save the changes.)
The command:
sed 's/+<89>/a/g;s/+<84>/u/g' input_file > output_file
will change all occurrences in input_file of "+<89>" to "a" and all occurrences of "+<84>" to "v" and write the updated contents to output_file.
I found the issue....its not normal Characters...
<89> was in blue which was same as ^M character (CTRL-V + M).
I need to find out whats the equivalent shortcut for <89> too
od -bc?
It is a bit crude, but 'cat -v' makes all odd characters into real glyph characters, like null is '^@', which sed can translate.
I have a very portable, trivial C program called census that tells me what bytes are in a file how many times:
$ all256|census
1 000 00 000 ''
1 001 01 001 ''
1 002 02 002 ''
1 003 03 003 ''
1 004 04 004 ''
1 005 05 005 ''
1 006 06 006 ''
1 007 07 007 ''
1 008 08 010 '
1 009 09 011 ' '
1 010 0a 012 '
'
1 011 0b 013 '
'
1 012 0c 014 '
'
' 013 0d 015 '
1 014 0e 016 ''
1 015 0f 017 ''
1 016 10 020 ''
1 017 11 021 ''
1 018 12 022 ''
1 019 13 023 ''
1 020 14 024 ''
1 021 15 025 ''
1 022 16 026 ''
1 023 17 027 ''
1 024 18 030 ''
1 025 19 031 ''
1 026 1a 032 ''
1 027 1b 033 '
1 028 1c 034 ''
1 029 1d 035 ''
1 030 1e 036 ''
1 031 1f 037 ''
1 032 20 040 ' '
1 033 21 041 '!'
1 034 22 042 '"'
1 035 23 043 '#'
1 036 24 044 '$'
1 037 25 045 '%'
1 038 26 046 '&'
1 039 27 047 '''
1 040 28 050 '('
1 041 29 051 ')'
1 042 2a 052 '*'
1 043 2b 053 '+'
1 044 2c 054 ','
1 045 2d 055 '-'
1 046 2e 056 '.'
1 047 2f 057 '/'
1 048 30 060 '0'
1 049 31 061 '1'
1 050 32 062 '2'
1 051 33 063 '3'
1 052 34 064 '4'
1 053 35 065 '5'
1 054 36 066 '6'
1 055 37 067 '7'
1 056 38 070 '8'
1 057 39 071 '9'
1 058 3a 072 ':'
1 059 3b 073 ';'
1 060 3c 074 '<'
1 061 3d 075 '='
1 062 3e 076 '>'
1 063 3f 077 '?'
1 064 40 100 '@'
1 065 41 101 'A'
1 066 42 102 'B'
1 067 43 103 'C'
1 068 44 104 'D'
1 069 45 105 'E'
1 070 46 106 'F'
1 071 47 107 'G'
1 072 48 110 'H'
1 073 49 111 'I'
1 074 4a 112 'J'
1 075 4b 113 'K'
1 076 4c 114 'L'
1 077 4d 115 'M'
1 078 4e 116 'N'
1 079 4f 117 'O'
1 080 50 120 'P'
1 081 51 121 'Q'
1 082 52 122 'R'
1 083 53 123 'S'
1 084 54 124 'T'
1 085 55 125 'U'
1 086 56 126 'V'
1 087 57 127 'W'
1 088 58 130 'X'
1 089 59 131 'Y'
1 090 5a 132 'Z'
1 091 5b 133 '['
1 092 5c 134 '\'
1 093 5d 135 ']'
1 094 5e 136 '^'
1 095 5f 137 '_'
1 096 60 140 '`'
1 097 61 141 'a'
1 098 62 142 'b'
1 099 63 143 'c'
1 100 64 144 'd'
1 101 65 145 'e'
1 102 66 146 'f'
1 103 67 147 'g'
1 104 68 150 'h'
1 105 69 151 'i'
1 106 6a 152 'j'
1 107 6b 153 'k'
1 108 6c 154 'l'
1 109 6d 155 'm'
1 110 6e 156 'n'
1 111 6f 157 'o'
1 112 70 160 'p'
1 113 71 161 'q'
1 114 72 162 'r'
1 115 73 163 's'
1 116 74 164 't'
1 117 75 165 'u'
1 118 76 166 'v'
1 119 77 167 'w'
1 120 78 170 'x'
1 121 79 171 'y'
1 122 7a 172 'z'
1 123 7b 173 '{'
1 124 7c 174 '|'
1 125 7d 175 '}'
1 126 7e 176 '~'
1 127 7f 177 ''
1 128 80 200 ''
1 129 81 201 ''
1 130 82 202 ''
1 131 83 203 ''
1 132 84 204 ''
1 133 85 205 ''
1 134 86 206 ''
1 135 87 207 ''
1 136 88 210 ''
1 137 89 211 ''
1 138 8a 212 ''
1 139 8b 213 ''
1 140 8c 214 ''
1 141 8d 215 ''
1 142 8e 216 ''
1 143 8f 217 ''
1 144 90 220 ''
1 145 91 221 ''
1 146 92 222 ''
1 147 93 223 ''
1 148 94 224 ''
1 149 95 225 ''
1 150 96 226 ''
1 151 97 227 ''
1 152 98 230 ''
1 153 99 231 ''
1 154 9a 232 ''
1 155 9b 233 ''
1 156 9c 234 ''
1 157 9d 235 ''
1 158 9e 236 ''
1 159 9f 237 ''
1 160 a0 240 ' '
1 161 a1 241 '�'
1 162 a2 242 '�'
1 163 a3 243 '�'
1 164 a4 244 '�'
1 165 a5 245 '�'
1 166 a6 246 '�'
1 167 a7 247 '�'
1 168 a8 250 '�'
1 169 a9 251 '�'
1 170 aa 252 '�'
1 171 ab 253 '�'
1 172 ac 254 '�'
1 173 ad 255 '�'
1 174 ae 256 '�'
1 175 af 257 '�'
1 176 b0 260 '�'
1 177 b1 261 '�'
1 178 b2 262 '�'
1 179 b3 263 '�'
1 180 b4 264 '�'
1 181 b5 265 '�'
1 182 b6 266 '�'
1 183 b7 267 '�'
1 184 b8 270 '�'
1 185 b9 271 '�'
1 186 ba 272 '�'
1 187 bb 273 '�'
1 188 bc 274 '�'
1 189 bd 275 '�'
1 190 be 276 '�'
1 191 bf 277 '�'
1 192 c0 300 '�'
1 193 c1 301 '�'
1 194 c2 302 '�'
1 195 c3 303 '�'
1 196 c4 304 '�'
1 197 c5 305 '�'
1 198 c6 306 '�'
1 199 c7 307 '�'
1 200 c8 310 '�'
1 201 c9 311 '�'
1 202 ca 312 '�'
1 203 cb 313 '�'
1 204 cc 314 '�'
1 205 cd 315 '�'
1 206 ce 316 '�'
1 207 cf 317 '�'
1 208 d0 320 '�'
1 209 d1 321 '�'
1 210 d2 322 '�'
1 211 d3 323 '�'
1 212 d4 324 '�'
1 213 d5 325 '�'
1 214 d6 326 '�'
1 215 d7 327 '�'
1 216 d8 330 '�'
1 217 d9 331 '�'
1 218 da 332 '�'
1 219 db 333 '�'
1 220 dc 334 '�'
1 221 dd 335 '�'
1 222 de 336 '�'
1 223 df 337 '�'
1 224 e0 340 '�'
1 225 e1 341 '�'
1 226 e2 342 '�'
1 227 e3 343 '�'
1 228 e4 344 '�'
1 229 e5 345 '�'
1 230 e6 346 '�'
1 231 e7 347 '�'
1 232 e8 350 '�'
1 233 e9 351 '�'
1 234 ea 352 '�'
1 235 eb 353 '�'
1 236 ec 354 '�'
1 237 ed 355 '�'
1 238 ee 356 '�'
1 239 ef 357 '�'
1 240 f0 360 '�'
1 241 f1 361 '�'
1 242 f2 362 '�'
1 243 f3 363 '�'
1 244 f4 364 '�'
1 245 f5 365 '�'
1 246 f6 366 '�'
1 247 f7 367 '�'
1 248 f8 370 '�'
1 249 f9 371 '�'
1 250 fa 372 '�'
1 251 fb 373 '�'
1 252 fc 374 '�'
1 253 fd 375 '�'
1 254 fe 376 '�'
1 255 ff 377 '�'
256 Total
$ cat mysrc/census.c
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv ){
unsigned long long cts[256] ;
unsigned long long tct = 0L ;
unsigned long long i ;
int c ;
for ( c = 0 ; c < 256 ; c++ )
{
cts[c] = 0L ;
}
while ( EOF != ( c = getchar() ) )
{
cts[c]++ ;
tct++ ;
}
if ( ferror( stdin ) )
{
perror( "stdin" );
exit( 1 );
}
for ( c = 0 ; c < 256 ; c++ )
{
if ( 0L != ( i = cts[c] ) )
{
printf( "%llu\t%3.3u\t%2.2x\t%3.3o\t'%c'\n", i, c, c, c, c );
}
}
printf( "%llu\tTotal\n", tct );
exit( 0 );
}
$