Sponsored Content
Full Discussion: Perl script parsing Help
Top Forums Shell Programming and Scripting Perl script parsing Help Post 302319082 by durden_tyler on Saturday 23rd of May 2009 08:17:00 PM
Old 05-23-2009
Code:
$
$ cat test_scr.pl
use Unicode::String qw(utf8 uhex);
$str = "DJEČJI SVIJET";
$u = utf8($str);
print "Initial String      -> ",$str,"\n";
print "Unicode code points -> ",$u->uhex,"\n";

$
$ perl test_scr.pl
Initial String      -> DJEČJI SVIJET
Unicode code points -> U+0044 U+004a U+0045 U+010c U+004a U+0049 U+0020 U+0053 U+0056 U+0049 U+004a U+0045 U+0054
$
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Conversion of bash parsing script to perl?

I need help with a perl parsing script. I have some error logs on a windows machine that I need to parse from a text file, but I know nothing about perl. I usually run this bash script on my linux box and it does just what I need. How would I do the same thing with perl and port it to my windows... (2 Replies)
Discussion started by: cstovall
2 Replies

2. Shell Programming and Scripting

HTML parsing by PERL

i have a HTML report file..its in attachment(a part of the whole report is attached..name "input html.doc").also its source is attached in "report source code.txt" i just want to seperate the datas like in first line it should be.. NHTEST-3848498958-NHTEST-10.2-no-baloo a and so on for whole... (3 Replies)
Discussion started by: avik1983
3 Replies

3. Shell Programming and Scripting

Perl: parsing variables

I have the following script: #!/usr/bin/perl -w @files = <*.csv>; foreach $file (@files) { open(FH, $file); my @dt = split(/_|.csv/, $file); while (<FH>) { chomp; print $dt . $dt . ",$_\n"; } close(FH); } This script reads in all csv files in the current directory... (2 Replies)
Discussion started by: figaro
2 Replies

4. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

5. Programming

Parsing a string in PERL

I have an extractfile (with fields delimited by pipes '|') and I want to prepend a counter based on the below requirements: - The counter starts at 3. - The counter increments only if the date (67th field of the extractfile) is different. Below is what I started off with: $cnt=2;... (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

6. Shell Programming and Scripting

Parsing file in perl script

Hi Guys, I have a large text file that is has a bunch of records. Each record starts with a header line that starts with the ">" character. Then there are several lines under that line that contain sequences of letters. For example, a file might look like: >TEXT ID=2L TEXT... (2 Replies)
Discussion started by: maverick.usb
2 Replies

7. Shell Programming and Scripting

Perl - switch parsing

I want to write a script that performs this type of behavior: Example: ./Myscript.pl -a ARGUMENTRun code 'a' ./Myscript.pl -b ARGUMENT Run code 'b' Do I use a case statement, functions? I am new to perl, just a code template on how to achieve this would be great. (1 Reply)
Discussion started by: streetfighter2
1 Replies

8. Shell Programming and Scripting

parsing argument in perl

in bash: LIST=`cat $1` for i in $LIST do ... done how will i do this in perl ? $1 is my first arguement. I'm a newbie in perl and will appreciate much your help guys ... (4 Replies)
Discussion started by: linuxgeek
4 Replies

9. UNIX for Advanced & Expert Users

Perl parsing help required.

Hello, I got a file like this. 5201 5202 5203 5204 1234 2345 3456 4567 6210 6220 6230 6240 The required output should be 5201 1234 6210 (9 Replies)
Discussion started by: suverman
9 Replies

10. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
PERLCN(1)						 Perl Programmers Reference Guide						 PERLCN(1)

XXXXXXXXXXXXXXXXXX, XXXXXXXXXXXX.  XXXXXX POD (XXXXXX) XX; XXXXXXXXXXXXXX, XXXXXX. XXXXXXXXXXX, XXX perlpod XXXX.

NAME
perlcn - XXXX Perl XX DESCRIPTION
XXXX Perl XXX! X 5.8.0 XXX, Perl XXXXXX Unicode (XXX) XX, XXXXXXXXXXXXXXXXXXX; CJK (XXX) XXXXXXXX. Unicode XXXXXXX, XXXXXXXXXXXX: XXXX, XXXX, XXXXXXXX (XXX, XXXX, XXXX, XXXX, XXX, XXXX, XX). XXXXXXXXXXXXXX (X PC XXXX). Perl XXX Unicode XXXX. XXX Perl XXXXXXXXXX Unicode XX; Perl XXXXXX (XXXXXXXXX) XXX Unicode XXXX. XXXXXXX, XXXXX Unicode XXXXXXXXXXXX, Perl XXX Encode XXXX, XXXXXXXXXXXXXXXXXXX. Encode XXXXXXXXXXXXXXXXX ('gb2312' XX 'euc-cn'): euc-cn Unix XXXXX, XXXXXXXXX gb2312-raw XXXXX (XXX) GB2312 XXX gb12345 XXXXXXXXXXXXXX iso-ir-165 GB2312 + GB6345 + GB8565 + XXXX cp936 XXX 936, XXXX 'GBK' (XXXXX) XX hz 7 XXXXX GB2312 XX XXXX, X EUC-CN XXXXXXX Unicode, XXXXXXXX: perl -Mencoding=euc-cn,STDOUT,utf8 -pe1 < file.euc-cn > file.utf8 Perl XXXX "piconv", XXXXX Perl XXXXXXXXXXX, XXXX: piconv -f euc-cn -t utf8 < file.euc-cn > file.utf8 piconv -f utf8 -t euc-cn < file.utf8 > file.euc-cn XX, XX encoding XX, XXXXXXXXXXXXXXXXX, XXXX: #!/usr/bin/env perl # XX euc-cn XXXX; XXXXXXXXXXXXX euc-cn XX use encoding 'euc-cn', STDIN => 'euc-cn', STDOUT => 'euc-cn'; print length("XX"); # 2 (XXXXXXX) print length('XX'); # 4 (XXXXXXX) print index("XXXX", "XX"); # -1 (XXXXXXXX) print index('XXXX', 'XX'); # 1 (XXXXXXXX) XXXXXXXX, "X" XXXXXXX "X" XXXXXXXXX EUC-CN XX "X"; "X" XXXXXXXX "X" XXXXXXXXX "X". XXXXXX EUC-CN XXXXXXXXXXX. XXXXXXX XXXXXXXXXXX, XXX CPAN (<http://www.cpan.org/>) XX Encode::HanExtra XX. XXXXXXXXXXX: gb18030 XXXXXXX, XXXXXX XX, Encode::HanConvert XXXXXXXXXXXXXXXX: big5-simp Big5 XXXXX Unicode XXXXXX gbk-trad GBK XXXXX Unicode XXXXXX XXX GBK X Big5 XXXX, XXXXXXXXX b2g.pl X g2b.pl XXXX, XXXXXXXXXXX: use Encode::HanConvert; $euc_cn = big5_to_gb($big5); # X Big5 XX GBK $big5 = gb_to_big5($euc_cn); # X GBK XX Big5 XXXXXX XXX Perl XXXXXXXXX (XXXXXXXXX), XXXXXXX Perl XXX, XX Unicode XXXXX. XX, XXXXXXXXX: XX Perl XXXXX <http://www.perl.com/> Perl XXX (XXXXXXXX) <http://www.cpan.org/> Perl XXXXX (Comprehensive Perl Archive Network) <http://lists.perl.org/> Perl XXXXXX XX Perl XXX <http://www.oreilly.com.cn/index.php?func=booklist&cat=68> XXXXXXXXX Perl XX Perl XXXXX <http://www.pm.org/groups/asia.html> XX Perl XXXXX Unicode XXXX <http://www.unicode.org/> Unicode XXXX (Unicode XXXXXX) <http://www.cl.cam.ac.uk/%7Emgk25/unicode.html> Unix/Linux XX UTF-8 X Unicode XXX SEE ALSO
Encode, Encode::CN, encoding, perluniintro, perlunicode AUTHORS
Jarkko Hietaniemi <jhi@iki.fi> Audrey Tang (XX) <audreyt@audreyt.org> perl v5.18.2 2013-11-04 PERLCN(1)
All times are GMT -4. The time now is 10:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy