Thanks rdrtx1.
I will test your solution tomorrow and let you know.
Thanks for your time and help regarding this.
---------- Post updated 10-03-12 at 10:21 AM ---------- Previous update was 10-02-12 at 10:32 PM ----------
Thanks for you help rdrtx1.
I am getting following error when i run it
$ awk -f { str1=substr($0,1,6); str2=substr($0,7,9); str3=substr($0,16,211-16); str4=substr($0,211,9); str5=substr($0,220); if (str2 == str4) gsub(".", " ", str4); print str1 str2 str3 str4 str5; } input.dat > output.dat
-bash: syntax error near unexpected token `('
---------- Post updated at 10:53 AM ---------- Previous update was at 10:21 AM ----------
Thanks you all for you help & time on this one.
Here is the code which worked fine.
Thanks
-LanceSunny
Hi
i am having text file like this
40000201040005200213072009000000700000050744820906904421
40069300240005200713072009000000067400098543630000920442
i want to replace 9-16 positions of my txt file...by 1234567...in a single line command
i.e
0400052....should be replaced by... (2 Replies)
I am attempting to replace positions 44-46 with YYY if positions 48-50 = XXX.
awk -F "" '{if (substr($0,48,3)=="XXX") $44="YYY"}1' OFS="" $filename > $tempfile
But this is not working, 44-46 is still spaces in my tempfile instead of YYY. Any suggestions would be greatly appreciated. (9 Replies)
I have a huge file with lot of rows... with each row around 400 characters.. with spaces as well..
(e.g)
Line1:
"AC254600606 USDMI000001Anom01130073981 0000000000000.002005040720991231 ... (13 Replies)
hii
i have a file that contains lines like this
4829:71370 1:N:0:CGATGT + chr6 126912761 GAAGGCATAGCCCGTTGGGCTGTGGTCATCAGCCTC CCCFFFFFHGHHHJHIJJJHIJIGHCGIIJJJJIJI 0 4829:71370 2:N:0:CGATGT + chr7 89349071 AGCCCTGCCCCCACCCCCCATTCTTCTTGACTGTCT C@@FFFFFHHHGHJ
JIJIJIIIIJJJJJJJJIIJIJ 0
Now i... (4 Replies)
I need to replace dashes (i.e. -) if present from positions 351-357 with zero (i.e. 0), I also need to replace dash (i.e “-“) if present between position 024-043 with zero (i.e. 0) & I replace " " (i.e. 2 space characters) if present at position 381-382 with "04". Total length of record is 413.... (11 Replies)
Script for if characters from positions 7-15 are matching with characters from position 211-219 then replace all char from 211-219 with 9 space.
Total length of record is 420. Here is the specification of the data in file.
Position Field Data Type... (5 Replies)
Hi all, I have column 2 full of values like HIVE4A-56 and HIVE4-56. I want to convert all values like HIVE4A-56 to HIVE4-56.
So basically I want to delete all single alphabets before the '-' which is always preceded by a number. Values already in the desired format should remain unchanged... (4 Replies)
My objective is to replace the 8th, 9th, 10th characters by 1 space per character (total 3 spaces) in a file.
I achieved this using following command:
sed 's/\(.\)/\1@/7;s/@\(...\)/ /' FileData.txt > FileData_UPDATED.txt
Another situation comes when I need to done same but excluding 1st... (5 Replies)
I have a test file a.txt
001 123 456 789
002 This is just a
001 test data
003 file.
I want to clear columns 5 and 6 if the first 3 characters are 001 using awk.
I tried following but does not work. Any suggestions?
awk 'BEGIN{OFS=FS=""} {if (substr($0,1,3)=="123") $5=" "; $6="... (20 Replies)
I have a fixed-length positional file. I am trying to replace content of position 4-13 (length=10) with xxxxxxxxxx.
Sample 2 rows in this file:
H0187459823 172SMITH, JOE
H0112345678 172DOE, JANE
In this example 87459823 (from 1st line) and 12345678 (from 2nd line) (both in position... (3 Replies)
Discussion started by: Diver181
3 Replies
LEARN ABOUT DEBIAN
unicode::escape
Unicode::Escape(3pm) User Contributed Perl Documentation Unicode::Escape(3pm)NAME
Unicode::Escape - Escape and unescape Unicode characters other than ASCII
VERSION
This document describes Unicode::Escape version 0.0.1
SYNOPSIS
# Escape Unicode charactors like '\u3042\u3043\u3044'.
# JSON thinks No more Garble!!
# case 1
use Unicode::Escape;
my $escaped1 = Unicode::Escape::escape($str1, 'euc-jp'); # $str1 contains charactor that is not ASCII. $str1 is encoded by euc-jp.
my $escaped2 = Unicode::Escape::escape($str2); # default is utf8 # $str2 contains charactor that is not ASCII.
my $unescaped1 = Unicode::Escape::unescape($str3, 'shiftjis'); # $str3 contains escaped Unicode character. return value is encoded by shiftjis.
my $unescaped2 = Unicode::Escape::unescape($str4); # default is utf8 # $str4 contains escaped Unicode character.
# case 2
use Unicode::Escape qw(escape unescape);
my $escaped1 = escape($str1, 'euc-jp'); # $str1 contains charactor that is not ASCII. $str1 is encoded by euc-jp.
my $escaped2 = escape($str2); # default is utf8 # $str2 contains charactor that is not ASCII.
my $unescaped1 = unescape($str3, 'shiftjis'); # $str3 contains escaped Unicode character. return value is encoded by shiftjis.
my $unescaped2 = unescape($str4); # default is utf8 # $str4 contains escaped Unicode character.
# case 3
use Unicode::Escape;
my $escaper = Unicode::Escape->new($str, 'shiftjis'); # $str contains charactor that is not ASCII. $str is encoded by shiftjis.(default is utf8)
my $escaped = $escaper->escape;
# case 4
use Unicode::Escape;
my $escaper = Unicode::Escape->new($str); # $str contains escaped Unicode character.
my $unescaped1 = $escaper->unescape('shiftjis');
my $unescaped2 = $escaper->unescape; # default is utf8.
DESCRIPTION
Escape and unescape Unicode characters other than ASCII. When the server response is javascript code, it is convenient.
METHODS
new( $string[, $encode ] )
string
Target string for escape or unescape.
encode
For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode)
escape( $string[, $encode ] )
string
Target string. This argument is unnecessary when called as object method.
encode
For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) This argument is unnecessary when called as object method.
unescape( $string[, $encode ] )
string
Target string. This argument is unnecessary when called as object method.
encode
For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode)
SEE ALSO
Unicode::String, Encode
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to "bug-unicode-escape@rt.cpan.org", or through the web interface at <http://rt.cpan.org>.
AUTHOR
Hitoshi Amano "<seijro@gmail.com>"
LICENCE AND COPYRIGHT
Copyright (c) 2006, Hitoshi Amano "<seijro@gmail.com>". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
perl v5.12.3 2011-06-05 Unicode::Escape(3pm)