锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲youwu永久无码精品 ,亚洲色婷婷综合开心网,亚洲欧洲无卡二区视頻http://m.tkk7.com/Skynet/category/37728.htmlzh-cnMon, 14 Dec 2009 13:17:17 GMTMon, 14 Dec 2009 13:17:17 GMT60shell txt 鍒嗘瀽灝忕粨http://m.tkk7.com/Skynet/archive/2009/11/26/303750.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Thu, 26 Nov 2009 03:27:00 GMThttp://m.tkk7.com/Skynet/archive/2009/11/26/303750.htmlhttp://m.tkk7.com/Skynet/comments/303750.htmlhttp://m.tkk7.com/Skynet/archive/2009/11/26/303750.html#Feedback1http://m.tkk7.com/Skynet/comments/commentRss/303750.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/303750.html




]]>
perl 浣跨敤灝忕粨http://m.tkk7.com/Skynet/archive/2009/11/11/301957.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Wed, 11 Nov 2009 05:36:00 GMThttp://m.tkk7.com/Skynet/archive/2009/11/11/301957.htmlhttp://m.tkk7.com/Skynet/comments/301957.htmlhttp://m.tkk7.com/Skynet/archive/2009/11/11/301957.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/301957.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/301957.html



鐜璁劇疆錛氬鏋滄湁緋葷粺瀛楃緙栫爜 鍐茬獊錛屽湪褰撳墠
vim 
~/.bash_profile 涓嬪姞鍏?br /> LANG=zh_CN
LC_ALL
=zh_CN.UTF8
export LANG LC_ALL


瀛楃緙栫爜杞寲
:
  
# 鐢眃ecode瑙f瀽,榛樿浼氫嬌鐢?nbsp;緋葷粺緙栫爜 杈撳嚭
  # 鍦?nbsp;linux 涓嬮潰鍏跺疄絳変環 encode("UTF-8", decode("GBK",$_));

perl -MEncode -ne 'print decode("GBK",$_);'  file.txt

鍒ゆ柇鏁版嵁鏄惁絎﹀悎杈撳嚭錛?br />   echo 
"121" |perl -ne 'print if /2/;'   #print 123

鍖歸厤姝e垯group杈撳嚭
:
  echo 
"abc121a" |perl -ne 'print $1 if /(\D+)/;'   #print abc

澶у皬鍐欒漿鍖栵細
  
# 鍏ㄩ儴 澶у皬杞皬鍐?/span>
  echo "ABC1C2cGJ" |perl -ne 'tr/[A-Z]/[a-z]/; print ;'  #print
  # "L 涓棿鍏ㄩ儴灝忓啓 "E   ; "U 涓棿鍏ㄩ儴澶у啓 "E    ↓

  echo "ABC1C2cGJ" |perl -ne 's/(.*?1)(.*?)(2.*?)/$1\L$2\E$3/g; print ;'  #print ABC1c2cGJ



婧愭枃浠舵浛鎹細
   echo 
"ABC 123" > te
   sed 
-'s/ABC/abc/g' te
       鎴栬?nbsp;
: perl --pe 's/ABC/abc/g' te
   cat te 
# print abc 123


澶栭儴浼犲弬
:
 
tt="cc"
  echo "gg" |perl -ne ' print "'$tt'" ;'
  杈撳嚭錛歝c

  perl -e  'print "$ARGV[0]\t$ARGV[1]\n" '  'par1' 'par2'  #print par1 par2
 


閲嶅鍒楄緭鍑?/span>:
   cat xx
.txt | awk -F"    " 'a[$1]++'
   鎴栬?nbsp;
:   
   cat xx
.txt |perl -F"\t" -ane  '$a{$F[1]}++;END{
        while(($k,$v)=each(%a)){ print "$k = $v "n"; }
    }
'
    緇撴灉姣斿錛?br />        鐧懼害鎵嬫満鍦ㄧ嚎 
= 7
       涓叴 
= 2
       涓囦俊鎭掗?nbsp; 
= 2
   榪樻瘮濡傦細鏌ョ湅鍚勭敤鎴?nbsp;鏈夊灝戜釜榪涚▼
   ps 
-ef |perl  -ane  '$a{$F[0]}++;END{
      while(($k,$v)=each(%a)){ print "$k = $v \n"; }
   }
'

姹?nbsp;涓ら」  浜ら泦
cat BuyMusic
.20090525| perl -ne 'BEGIN{
 $p1="600902000005416300";
 $p2="600902000006211983";
 $p_col=30;
 $mob_col=0;

}END{
  my @inter = grep {$a{$_}} keys %b; # 姹備氦闆?br />   #print $p1,"=",join(",",keys %a),""n";
  #print $p2,"=",join(",",keys %b),""n";
  print "浜у搧 $p1:",scalar keys %a," "n";
  print "浜у搧 $p2:",scalar keys %b," "n";
  print "浜ら泦:",scalar @inter," "n";
}
chomp;
@lis=split /\|<>\|/ ;
if( $lis[ $p_col] eq $p1 ){
   $a{$lis[$mob_col]}++;
}
if( $lis[$p_col] eq $p2 ){
   $b{$lis[$mob_col]}++;
}
'

 

鍏抽敭瀛?nbsp;Top 
10 錛岃緭鍑烘簮鏂囨湰鏁版嵁 :
perl 
-e  '
  my $num=10; # top 10
  open(MYFILE, "<$ARGV[0]");
  open(MYFILE2, "<$ARGV[0]");

  # 鍏抽敭瀛楀垪鏁?br />   while(<MYFILE>){@lis=split /\|<>\|/;$fck{$lis[1]}++ }

  foreach $k (sort { $fck{$b} <=> $fck{$a} } keys %fck){
     if(++$row>$num){last; }
     $arr[@arr] = $k;
  }
 
  while(<MYFILE2>){@lis=split /\|<>\|/;
     if(grep { $arr[$_] eq $lis[1] } 0..$#arr){
       # print "$fck{$lis[1]}:$_"; #甯?nbsp;鍏抽敭瀛楀嚭鐜版鏁拌緭鍑?br />        print ;
     }
  }
' qdSearch.log






]]>
hadoop streaming( hadoop + perl )灝忚瘯http://m.tkk7.com/Skynet/archive/2009/09/25/296420.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Fri, 25 Sep 2009 06:33:00 GMThttp://m.tkk7.com/Skynet/archive/2009/09/25/296420.htmlhttp://m.tkk7.com/Skynet/comments/296420.htmlhttp://m.tkk7.com/Skynet/archive/2009/09/25/296420.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/296420.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/296420.html   http://hadoop.apache.org/common/docs/r0.15.2/streaming.html

娉ㄦ剰
  鐩墠 streaming 瀵?linux pipe #涔熷氨鏄?cat |wc -l 榪欐牱鐨勭閬?涓嶆敮鎸侊紝浣嗕笉濡ㄧ鎴戜滑浣跨敤perl,python 琛屽紡鍛戒護錛侊紒
  鍘熻瘽鏄?錛?br />   Can I use UNIX pipes? For example, will -mapper "cut -f1 | sed s/foo/bar/g" work?
    Currently this does not work and gives an "java.io.IOException: Broken pipe" error.
    This is probably a bug that needs to be investigated.
  浣嗗鏋滀綘鏄己鐑堢殑 linux shell pipe 鍙戠儳鍙?錛?鍙傝冧笅闈?br />   $> perl -e 'open( my $fh, "grep -v null tt |sed -n 1,5p |");while ( <$fh> ) {print;} '
     #涓嶈繃鎴戞病嫻嬭瘯閫氳繃 錛侊紒

鐜 錛歨adoop-0.18.3
$> find . -type f -name "*streaming*.jar"
./contrib/streaming/hadoop-0.18.3-streaming.jar


嫻嬭瘯鏁版嵁錛?br />
-bash-3.00$ head tt 
null    false    3702    208100
6005100    false    70    13220
6005127    false    24    4640
6005160    false    25    4820
6005161    false    20    3620
6005164    false    14    1280
6005165    false    37    7080
6005168    false    104    20140
6005169    false    35    6680
6005240    false    169    32140
......


榪愯錛?br />
c1="  perl -ne  'if(/.*\t(.*)/){\$sum+=\$1;}END{print \"\$sum\";}'  "
# 娉ㄦ剰 榪欓噷 $ 瑕佸啓鎴?\$    " 鍐欐垚 \"
echo $c1; # 鎵撳嵃杈撳嚭  perl -ne 'if(/.*"t(.*)/){$sum+=$1;}END{print $sum;}'
hadoop jar hadoop-0.18.3-streaming.jar
  
-input file:///data/hadoop/lky/jar/tt 
   -
mapper   "/bin/cat" 
   -
reducer "$c1" 
  
-output file:///tmp/lky/streamingx8


緇撴灉:
cat /tmp/lky/streamingx8/*
1166480

鏈湴榪愯杈撳嚭:
perl -ne 'if(/.*"t(.*)/){$sum+=$1;}END{print $sum;}' < tt
1166480

緇撴灉姝g‘!!!!


鍛戒護鑷甫鏂囨。錛?br />
-bash-3.00$ hadoop jar hadoop-0.18.3-streaming.jar -info
09/09/25 14:50:12 ERROR streaming.StreamJob: Missing required option -input
Usage: $HADOOP_HOME
/bin/hadoop [--config dir] jar \
          $HADOOP_HOME
/hadoop-streaming.jar [options]
Options:
  
-input    <path>     DFS input file(s) for the Map step
  
-output   <path>     DFS output directory for the Reduce step
  
-mapper   <cmd|JavaClassName>      The streaming command to run
  
-combiner <JavaClassName> Combiner has to be a Java class
  
-reducer  <cmd|JavaClassName>      The streaming command to run
  
-file     <file>     File/dir to be shipped in the Job jar file
  
-dfs    <h:p>|local  Optional. Override DFS configuration
  
-jt     <h:p>|local  Optional. Override JobTracker configuration
  
-additionalconfspec specfile  Optional.
  
-inputformat TextInputFormat(default)|SequenceFileAsTextInputFormat|JavaClassName Optional.
  
-outputformat TextOutputFormat(default)|JavaClassName  Optional.
  
-partitioner JavaClassName  Optional.
  
-numReduceTasks <num>  Optional.
  
-inputreader <spec>  Optional.
  
-jobconf  <n>=<v>    Optional. Add or override a JobConf property
  
-cmdenv   <n>=<v>    Optional. Pass env.var to streaming commands
  
-mapdebug <path>  Optional. To run this script when a map task fails 
  
-reducedebug <path>  Optional. To run this script when a reduce task fails 
  
-cacheFile fileNameURI
  
-cacheArchive fileNameURI
  
-verbose




]]>
閮ㄥ垎楂樼駭姝e垯鐗規?浣跨敤http://m.tkk7.com/Skynet/archive/2009/08/27/292835.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Thu, 27 Aug 2009 08:04:00 GMThttp://m.tkk7.com/Skynet/archive/2009/08/27/292835.htmlhttp://m.tkk7.com/Skynet/comments/292835.htmlhttp://m.tkk7.com/Skynet/archive/2009/08/27/292835.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/292835.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/292835.html涓浜涚壒孌婃鍒欏厓瀛楃璇存槑:
 
1. *? 鍜?nbsp;+? 鍜?nbsp;{n,}?  鎳掓儼鍖歸厤 
  
1.1 闈炴噿鎯?nbsp;銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆   ↓
    echo 
"ab2c121a" |perl -ne 'print $1 if /(.*)"d/;'   #print ab2c12
   
1.2 鎳掓儼 銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆      ↓
    echo 
"ab2c121a" |perl -ne 'print $1 if /(.*?)"d/;'   #print ab
 
2.  鍥炴函寮曠敤鍜屽墠鍚庢煡鎵?/span>:
  
2.1 鍚戝墠鏌ユ壘   (?=..)    銆銆銆銆銆銆銆銆銆銆銆銆   ↓
    echo 
"ab2c121a" |perl -ne 'print $1 if /(.*?)(?=2)/;'  #print ab
  
2.2 鍚戝悗鏌ユ壘 (?<=..)  銆  銆     銆銆銆銆銆銆↓
    echo 
"ab2c121a" |perl -ne 'print $1 if /(?<=2)(.*)(?=2)/;' #print c1
  
2.3 璐熷悜-鍓?/span>/鍚?nbsp;鏌ユ壘  (?!..) (?<!..)   
   
#涓嶈兘鍖歸厤 ..                               ↓
   
echo "ab2c121a" |perl -ne 'print $1 if /(?<!2)(c.*)/;'    #print 鏃?/span>
   
echo "ab2c121a" |perl -ne 'print $1 if /(?<!3)(c.*)/;'    #print c121a
  
2.4 鏉′歡 ?()  = if   ?()| = if else
   
# ?()  渚嬪  <p> </p> 蹇呴』鍚屾椂鍑虹幇                ↓      ↓  
   
echo "<p>xx</p>"|perl -ne 'print $2  if /(<p>)?("w*)(?(1)<"/p>)/'   #print  xx
   
echo "<p>xx"|perl -ne 'print $2,""n" if /(<p>)?("w*)(?(1)<"/p>)/'    #print 絀?/span>
   
echo "xx"|perl -ne 'print $2 if /(<p>)?("w*)(?(1)<"/p>)/'    #print xx
    # ?()|  渚嬪 榪樻槸涓婇潰鐨勶紝 
    # 褰?nbsp;鏈?lt;p> 鍙互鎺?lt;/p> 涔熷彲浠ユ帴 鏁板瓧緇撳熬                            ↓

echo 
"<p>xx1</p>"|perl -ne 'print $2  if /(<p>)?("w*)(?(1)<"/p>|"d)/'  #print xx1
echo 
"<p>xx1"|perl -ne 'print $2  if /(<p>)?("w*)(?(1)<"/p>|"d)/'    # print xx






]]>
perl vs php (杞?http://m.tkk7.com/Skynet/archive/2009/05/15/270947.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Fri, 15 May 2009 15:09:00 GMThttp://m.tkk7.com/Skynet/archive/2009/05/15/270947.htmlhttp://m.tkk7.com/Skynet/comments/270947.htmlhttp://m.tkk7.com/Skynet/archive/2009/05/15/270947.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/270947.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/270947.html

Perl/Php Translation

arrays

hashes

data structures

array split/join

case conversion

string comparisons

functions

string matching operations

basename/dirname

environment variables

POST/GET parameters

HTML elements

URL encode

MySQL database access


鈥?Perl arrays 鈥?/th> 鈥?Php arrays 鈥?/th>
@a = ();

@a = ( 'xx', 11, 33.5, );

@a = 12..33;

$a[2] = 'something';

$len = scalar(@a);
# or
$len = @a;

@a3 = ('xx', @a1, @a2);

($x, $y) = @a;

$a[@a] = 'new'; # push

push
pop
shift
unshift
splice

foreach $i (@a) { .. }
$a = array();

$a = array( 'xx', 11, 33.5, );

$a = range(12,33);

$a[2] = 'something';

$len = count($a);



$a3 = array_merge('xx', $a1, $a2);

list($x, $y) = $a;

$a[] = 'new'; # push

array_push
array_pop
array_shift
array_unshift
array_splice

foreach ($a as $i) { .. }
鈥?Perl hashes 鈥?/th> 鈥?Php hashes 鈥?/th>
%h = ();

%h = ( 'x' => 'y',
'z' => 'w',
);

$h{'x'} = 7;

while (($key,$value) = each(%h))
{ .. }

$a = keys(%h);
$b = values(%h);

delete $h{'x'};
$h = array();

$h = array( 'x' => 'y',
'z' => 'w',
);

$h['x'] = 7;

foreach ($h as $key => $value)
{ .. }

$a = array_keys($h);
$b = array_values($h);

unset( $h['x'] );

鈥?Perl data structures 鈥?/th> 鈥?Php data structures 鈥?/th>
%h = ('a'=>13, 'b'=>25);
@x = ('hi', 'there', 'all',);

@mix = ( %h, @x,
[33..39],
{ x=>15, yy=>23, },
);

$mix[0]->{'b'} # == 25
$mix[0]{'b'} # == 25
$mix[2]->[2] # == 35
$mix[2][2] # == 35

$h = array('a'=>13, 'b'=>25);
$x = array('hi', 'there', 'all',);

$mix = array($h, $x,
range(33,39),
array('x'=>15, 'yy'=>23),
);

$mix[0]['b'] # == 25

$mix[2][2] # == 35

鈥?Perl array split/join 鈥?/th> 鈥?Php array split/join 鈥?/th>
@a = split( '|', $s );

@a = split( 's+', $s );


$s = join( '|', @a );
$a = preg_split( '/|/', $s,
-1, PREG_SPLIT_NO_EMPTY );
$a = preg_split( '/s+/', $s,
-1, PREG_SPLIT_NO_EMPTY );

$s = join( '|', $a );
鈥?Perl case conversion 鈥?/th> 鈥?Php case conversion 鈥?/th>
$s = lc($s);
$s = uc($s);

$s =~ tr/a-z/A-Z/;
$s = strtolower($s);
$s = strtoupper($s);


鈥?Perl string comparisons 鈥?/th> 鈥?Php string comparisons 鈥?/th>
$s1 eq $s2



$s1 lt $s2
strcmp($s1,$s2) == 0
# or
$s1 === $s2

strcmp($s1,$s2) < 0
鈥?Perl functions 鈥?/th> 鈥?Php functions 鈥?/th>
sub foo {
my @args = @_;
}

sub foo {
$x = 5;
}





foo2( @a, %h );
function foo() {
$args = func_get_args();
}

function foo() {
global $x;
$x = 5;
}

function foo2($x, $y) {
}

foo2( $a, $h );
鈥?Perl string matching operations 鈥?/th> 鈥?Php string matching operations 鈥?/th>
$s =~ m/(w+)/;
$substr = $1;

@all = ($s =~ m/(w+)/g);


$s =~ s/s+/X/;
$s =~ s/s+/X/g;

$s =~ s/^s+|s+$//g;
preg_match( "/(w+)/", $s, $match );
$substr = $match[1];

preg_match_all( "/(w+)/", $s, $match );
$all = $match[0];

$s = preg_replace( "/s+/", 'X', $s, 1 );
$s = preg_replace( "/s+/", 'X', $s );

$s = trim($s);
鈥?Perl basename/dirname 鈥?/th> 鈥?Php basename/dirname 鈥?/th>
use File::Basename;

$b = basename($path);
$d = dirname($path);
 

$b = basename($path);
$d = dirname($path);
鈥?Perl environment variables 鈥?/th> 鈥?Php environment variables 鈥?/th>
%ENV

$ENV{REQUEST_METHOD}

$ARGV[$i]

$0
$_SERVER

$_SERVER[REQUEST_METHOD]

$argv[$i+1]

$argv[0] # Php/CGI only
鈥?Perl POST/GET parameters 鈥?/th> 鈥?Php POST/GET parameters 鈥?/th>
#form/hyperlink parameters:
# s : single-valued
# m : multi-valued

use CGI (:standard);




$s = param('s');
@m = param('m');

@param_names = param();
$num_params = param();
#form/hyperlink parameters:
# s : single-valued
# m[] : multi-valued
# (such as multi-selections
# and checkbox groups)

$PARAM
= array_merge($_GET, $_POST);

$s = $PARAM['s']; # a scalar
$m = $PARAM['m']; # an array

$param_names = array_keys($PARAM);
$num_params = count($PARAM);
鈥?Perl HTML elements 鈥?/th> 鈥?Php HTML elements 鈥?/th>
use CGI (:standard);







$ref = "x.cgi";
a({href=>$ref}, "yy")

textfield({name=>"yy", size=>5})

password({name=>"yy", size=>5})

textarea({name=>"yy",
cols=>5, rows=>2})

submit({value=>"yy"})

button( {name=>"xx",
value=>"yy",
onclick=>"submit()",
}
)

%labels = (0=>'a',1=>'q',2=>'x');
popup_menu( { name=>"xx",
values=>[0..2],
labels=>%labels,
size=>4,
}
)


@a = ('xx','yy','zz');
radio_group( { name=>'nn',
values=> @a,
default=>'_',
linebreak=>1,
}
)

%labels = ('xx'=>'L1','yy'=>'L2');
@a = keys( %labels );
checkbox_group( { name=>'nn',
values=> @a,
labels=> %labels,
}
)

table(
Tr(
[
td(['a','b']),
td(['x','y']),
]
)
)

# The Perl/CGI functions have the
# additional property of "stability"
# when used in reentrant forms.
# The values of the HTML elements are
# set according to the incoming
# parameter values for those elements.
# The versions below are not stable.

$ref = "x.php";
<a href="<?php echo $ref?>">yy</a>

<input type=text name=yy size=5>

<input type=password name=yy size=5>

<textarea name=yy cols=5 rows=2>

</textarea>

<input type="submit" value=yy>

<input type="button"
name="xx" value="yy"
onclick="submit()">



<select name="xx" size="4">
<?php
$labels = array(0=>'a',1=>'q',2=>'x');
foreach (range(0,2) as $_)
echo "<option value='$_'>",
$labels[$_];
?>

</select>

$a = array('xx','yy','zz');
foreach ($a as $_)
echo "<input type=radio
name=nn value='$_'>$_<br>";




$labels = array('xx'=>'L1','yy'=>'L2');
foreach (array_keys($labels) as $_)
echo "<input type=checkbox
name=nn value='$_'>",
$labels[$_];



<table>
<tr>
<td>a</td><td>b</td>

</tr>
<tr>
<td>x</td><td>y</td>
</tr>
</table>
鈥?Perl URL encode 鈥?/th> 鈥?Php URL encode 鈥?/th>
use URI::Escape;

uri_escape($val)
uri_unescape($val)
 


urlencode($val)
urldecode($val)
鈥?Perl MySQL database access 鈥?/th> 鈥?Php MySQL database access 鈥?/th>
use DBI;
$dbh = DBI->connect(
'DBI:mysql:test:localhost',
$usr,$pwd
);

$dbh->do( $sql_op )

$query = $dbh->prepare( $sql_op );
$query->execute();

while(
@record = $query->fetchrow() )
{ .. }


$dbh->quote($val)



 
$dbh = mysql_connect(
'localhost', $usr, $pwd
);
mysql_query('USE test')

mysql_query( $sql_op );

$results = mysql_query( $sql_op );


while($record =
mysql_fetch_row($results))
{ .. }


"'" . addslashes($val) . "'"



]]>
perl 浣跨敤http://m.tkk7.com/Skynet/archive/2009/04/01/263353.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Wed, 01 Apr 2009 06:12:00 GMThttp://m.tkk7.com/Skynet/archive/2009/04/01/263353.htmlhttp://m.tkk7.com/Skynet/comments/263353.htmlhttp://m.tkk7.com/Skynet/archive/2009/04/01/263353.html#Feedback2http://m.tkk7.com/Skynet/comments/commentRss/263353.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/263353.html
瀵瑰簲鑴氭湰榪愮敤錛?br />   1.  shell  緇熺綆$悊 鑴氭湰鐨勮繍琛屻傚悎鐞嗙粨鍚?crontab ,  ps -ef ,kill 絳夊懡浠ゃ?br />    2.  perl  澶勭悊鐭皬蹇?銆?br />    3.  python 鏈夋瘮杈冨鏉傜粨鏋勫拰閫昏緫鐨勩?br />  
鏈枃涓昏浠嬬粛 perl 鐨勮綰у懡浠や嬌鐢?錛屽姏姹?鐭?灝?蹇?錛?br />
#鏈綆鍗曠殑
$ perl -'print "Hello World\n"'

#澶勭悊鏂囦歡 琛?/span>
$ perl --'print $_' file1


#緙栫爜杞崲
#濡傛灉 鏈夐渶瑕?nbsp;鍦ㄤ嬌鐢ㄤ笅  encode("UTF-8", decode("GBK",$_));鍦?nbsp;linux 涓嬮粯璁?nbsp;utf-8

perl -MEncode -ne 'print decode("GBK",$_);'  file.txt




#姝e垯浣跨敤
   #  if($_=~/.*\/(.*)$/){  print $1 ;}  榪欐槸perl 宸ㄦ柟渚跨殑鍦版柟 $1 xx  
# next LINE 璺沖埌涓嬩竴涓驚鐜?/span>
$ perl --'next LINE unless /pattern/; print $_'


#鍘婚櫎鎹㈣ chomp
perl -'print split(/\n/,"asg\n");'


#鍍?nbsp;awk 涓鏍?nbsp;Begin End
$ perl -ne 'END { print $t } @w = /(\w+)/g; $t += @w' file.txt 

#鍍?nbsp;awk -F"x" 涓鏍?nbsp;鍒囧壊琛?br /> #-a 鎵撳紑鑷姩鍒嗙 (split)  妯″紡
#@F 涓?nbsp;鍒囧壊鍚庣殑 鏁扮粍

perl -F'\t' -ane '
 if($F[1]=~/渚冧緝/ and $F[2]=~/鐖辨儏鍟?){
      print "$F[3]\t$F[4]\t$F[5]\n"
  }
' all2_data.sort.st

瀹為檯澶勭悊錛?br />  
perl -F'\|\|' -ane '
 my $actor,$music ;
 if  ( $F[3] ){
  $music=$F[2];
  $actor=$F[3];
 }else{
  $music=$F[0];
  $actor=$F[1]; 
 }
  $music =~ tr/[A-Z]/[a-z]/;
  $music =~ s/\s*(.*)\s*\(.*\)/\1/g;
  $actor =~ tr/[A-Z]/[a-z]/;
  $actor =~ s/\s*(.*)\s*\(.*\)/\1/g;
print "$actor-$music\n";
' ring.utf8.txt  |sort -u  > ring.actor_music.sort.utf8.txt &
wc 
-l ring.actor_music.sort.utf8.txt


#鍍?nbsp;sed 涓鏍鋒浛鎹?br />     # -i 鍜?sed 涓鏍?perl 杈撳嚭浼氭浛鎹㈣皟 婧?file.txt
$ perl --pe 's/\bPHP\b/Perl/g' file.txt


#澶栭儴 浼犲弬
perl -ne'print "$ARGV[0]\t$ARGV[1]\n" ' file.txt 'par1' 'par2'
    #緇撴灉 ..  par1     par2 ..



# 鏌ヨ鍑?nbsp;閲嶅鍒?nbsp;嬈℃暟錛屽茍 鍒椾婦鍑烘潵
cut -d"     "  -2 .collection_mobile.data |perl -ne '
   END{
     while (($key,$value)=each(%a)){print $key,"=",$value,"\n";};
   }BEGIN{ %a =(); } 
   chomp;
   $a{$_}+=1; 
 
'
緇撴灉
Ring=532895
CRBT=68500
RingBoxes=880
Song=96765

 
#涓浜涘疄闄?/span>浣跨敤 :)
find . -name "*.mp3" | perl -pe 's/.\/\w+-(\w+)-.*/$1/' | sort | uniq
   perl -F'\t' -ane 'if($F[1]=~/$ARGV[0]/ and $F[2]=~/$ARGV[1]/){print "$F[3]\t$F[4]\t$F[5]\n"}' all2_data.sort.st '渚冧緝' '鐖辨儏鍟?

#涓?nbsp;find 鍚堢敤 -e $ARGV[0] 鎵歸噺 鎶?excel 鍊掓垚 鏂囨湰 鏍煎紡
find . -maxdepth 1 -name "*xls" -exec perl -'
require("/home/xj_liukaiyi/src/perl/excel/excelUtil.pl");
my $file=$ARGV[0];
sub myRead{
  
my $str = "";
  
for $tmp(@_){
    
$str="$str$tmp\t";
  }
  
$str="$str\n";
  
system "echo \"$str\" >> $file.data ";
}
&parse_excel("$file",0,\&myRead);
print "$file\n";
' {} \;




鍙傝冿細
http://www.ibm.com/developerworks/cn/linux/sdk/perl/l-p101/index.html
http://bbs.chinaunix.net/viewthread.php?tid=499434





]]>
perl 涓浜涙湁鐢ㄧ殑 util http://m.tkk7.com/Skynet/archive/2009/03/17/260234.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Tue, 17 Mar 2009 05:49:00 GMThttp://m.tkk7.com/Skynet/archive/2009/03/17/260234.htmlhttp://m.tkk7.com/Skynet/comments/260234.htmlhttp://m.tkk7.com/Skynet/archive/2009/03/17/260234.html#Feedback1http://m.tkk7.com/Skynet/comments/commentRss/260234.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/260234.html
#!/bin/perl -w
use Time::Local;

my $log_input_file="~/log";
sub set_log_input_file{
  
$log_input_file=$_[0];
}


#&perl_log("tt","/home/xj_liukaiyi/log");
sub perl_log{
  
my $log_msg=shift @_;
  
print $log_msg,"\n";
  
system 'ttmp1=$(date +%Y-%k-%d);ttmp2=$(date +%M:%S);echo "$ttmp1 $ttmp2:'."$log_msg".'" >>'.$log_input_file;
}

#&system_util("xls -l","~/log");
sub system_util{
  
my $comm=shift @_;
  
my @return=system $comm;
  
if ( $return[(@return-1)] == 0 ) { 
     
&perl_log("[success]".$comm,$log_input_file);
  }
else{
     
&perl_log("[error]".$comm,$log_input_file);
  }
  
return $return[(@return-1)];
}

1;

excel 璇誨彇util 
require("/home/xj_liukaiyi/src/perl/excel/excelUtil.pl");&parse_excel("2w.xls","姝屾洸鍒楄〃","&read_wlh);
#!/bin/perl -w
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::FmtUnicode; 
use Encode;
use Unicode::Map();
my $Map = new Unicode::Map("GB2312");


my $excelCODE='gb2312';
my $coslCODE='utf8';

my %parseCache ;
my %writeCache ;

my $oFmtJ = Spreadsheet::ParseExcel::FmtUnicode->new(Unicode_Map =>$excelCODE); 
my $oExcel = new Spreadsheet::ParseExcel;



#
#&parse_excel("all4.xls","涔愭墤","&read_lp); 
# sub read_lp{  $_[1 .. 2.3  ] }
sub parse_excel{
 
my $sExcelName=shift;
 
my $sSheetName=shift;
 
my $action_fun=shift;
 
 
my($iR, $iC, $oWkS,$oWkC);
 
#寮鍚?nbsp;excel
 my $oBook = $oExcel->Parse($sExcelName,$oFmtJ);
 
#鏍規嵁 sheet 鍚嶇О鍖歸厤 
 for(my $iSheet=0$iSheet < $oBook->{SheetCount} ; $iSheet++){
    
my $t_oWkS = $oBook->{Worksheet}[$iSheet];
    
my $sWkSName=encode($coslCODE,decode($excelCODE,$t_oWkS->{Name} ));
    
if($sWkSName=~/$sSheetName/){
      
$oWkS=$t_oWkS;
      
last;
   }
 }


 
for(my $iR = $oWkS->{MinRow} ;
     
defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
     
$iR++){
     
my @arr_row;
     
for(my $iC = $oWkS->{MinCol} ;
         
defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
         
$iC++){
       
$oWkC=$oWkS->{Cells}[$iR][$iC];
       
my $col_value="";
           
$col_value=encode($coslCODE,decode($excelCODE,$oWkC->Value) ) if ($oWkC) ;
           
push(@arr_row,$col_value);
         }
      
push(@arr_row,$iR);
     
$action_fun->(@arr_row);
    }
}

#浣跨敤 demo
find . -maxdepth 1 -name "*xls" -exec perl -'
require("/home/xj_liukaiyi/src/perl/excel/excelUtil.pl");
my $file=$ARGV[0];
sub myRead{
  my $str="";
  foreach$tmp(@_){
    $str+"$tmp\t";
  }
  system "echo $str >> $file.data";
}
&parse_excel("$file",0,\&myRead);
print "$file\n";
' {} \;





]]>
perl 宸ュ叿灝忚剼鏈?/title><link>http://m.tkk7.com/Skynet/archive/2009/03/02/257374.html</link><dc:creator>鍒樺嚡姣?/dc:creator><author>鍒樺嚡姣?/author><pubDate>Mon, 02 Mar 2009 09:51:00 GMT</pubDate><guid>http://m.tkk7.com/Skynet/archive/2009/03/02/257374.html</guid><wfw:comment>http://m.tkk7.com/Skynet/comments/257374.html</wfw:comment><comments>http://m.tkk7.com/Skynet/archive/2009/03/02/257374.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/Skynet/comments/commentRss/257374.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/Skynet/services/trackbacks/257374.html</trackback:ping><description><![CDATA[<br /> <br /> 宸ュ叿灝忚剼鏈?br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008000;">#</span><span style="color: #008000;">!/bin/perl</span><span style="color: #008000;"><br /> </span><span style="color: #0000ff;">use</span><span style="color: #000000;"> File</span><span style="color: #000000;">::</span><span style="color: #000000;">Find;<br /> </span><span style="color: #0000ff;">use</span><span style="color: #000000;"> </span><span style="color: #0000ff;">Log</span><span style="color: #000000;">::</span><span style="color: #000000;">FileSimple;<br /> <br /> </span><span style="color: #008000;">#</span><span style="color: #008000;">use strict;<br /> #use warnings;<br /> <br /> # 璇存槑: <br /> #     閬嶅巻鍑?nbsp;"/cygdrive/c/Documents and Settings/Administrator/"  <br /> #       婊¤凍 "^.*\.txt$" 娣誨姞鏂囦歡<br /> #         騫惰繍琛?nbsp;"ls -l $fileAllName " <br /> #    榪愯鏃ュ織 ./log<br /> #<br /> # perl this.pl  <br /> #     "ls -l $fileAllName " <br /> #     "/cygdrive/c/Documents and Settings/Administrator/"  <br /> #     "^.*\.txt$"<br /> #     ./log<br /> #<br /> # run_comm 鍙傛暟1 鏇挎崲璇存槑錛?br /> #     $filePath  涓鴻緭鍏ュ弬鏁?錛岄亶鍘嗘牴鐩綍 "/cygdrive/c/Documents and Settings/Administrator/"  <br /> #    $fileAllName 涓哄綋鍓嶉亶鍘嗭紝婊¤凍姝e垯鏉′歡鐨?nbsp;鍏ㄨ礬寰?鏂囦歡鍚?br /> #    $logicFileAllName  涓哄綋鍓嶉亶鍘嗭紝婊¤凍姝e垯鏉′歡鐨?nbsp;閫昏緫璺緞+鏂囦歡鍚?br /> #    $logicFilePath 涓哄綋鍓嶉亶鍘嗭紝閫昏緫璺緞<br /> #    $logicFileName 鏂囦歡鍚嶇О<br /> #    $logicFileExp  鏂囦歡鍚庣紑  <br /> #        錛坱est.txt 鏂囦歡  <br /> #            $logicFileName 涓?nbsp;test <br /> #            $logicFileExp 涓?nbsp;txt<br /> #            錛?/span><span style="color: #008000;"><br /> </span><span style="color: #000000;"><br /> </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$run_comm</span><span style="color: #000000;">=</span><span style="color: #800080;">$ARGV</span><span style="color: #000000;">[</span><span style="color: #800000;">0</span><span style="color: #000000;">];<br /> </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$file_path</span><span style="color: #000000;">=</span><span style="color: #800080;">$ARGV</span><span style="color: #000000;">[</span><span style="color: #800000;">1</span><span style="color: #000000;">];<br /> </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$file_find_rex</span><span style="color: #000000;">=</span><span style="color: #800080;">$ARGV</span><span style="color: #000000;">[</span><span style="color: #800000;">2</span><span style="color: #000000;">];<br /> </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$logfile</span><span style="color: #000000;">=</span><span style="color: #800080;">$ARGV</span><span style="color: #000000;">[</span><span style="color: #800000;">3</span><span style="color: #000000;">];<br /> <br /> <br /> </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$log</span><span style="color: #000000;"> </span><span style="color: #000000;">=</span><span style="color: #000000;"> new </span><span style="color: #0000ff;">Log</span><span style="color: #000000;">::</span><span style="color: #000000;">FileSimple(name</span><span style="color: #000000;">=></span><span style="color: #000000;"> </span><span style="color: #000000; font-weight: bold;">'</span><span style="color: #000000; font-weight: bold;">Log::FileSimple logs</span><span style="color: #000000; font-weight: bold;">'</span><span style="color: #000000;">,</span><span style="color: #000000;"><br />                               file      </span><span style="color: #000000;">=></span><span style="color: #000000;"> </span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000; font-weight: bold;">$logfile</span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000;">,</span><span style="color: #000000;"><br />                               mask      </span><span style="color: #000000;">=></span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #800000;">1</span><span style="color: #000000;">,</span><span style="color: #000000;"><br />                               autoflush </span><span style="color: #000000;">=></span><span style="color: #000000;"> </span><span style="color: #800000;">0</span><span style="color: #000000;">,</span><span style="color: #000000;"><br />                               );<br /> <br /> </span><span style="color: #0000ff;">sub</span><span style="color: #000000;"> fileThumb{<br />  </span><span style="color: #0000ff;">eval</span><span style="color: #000000;">{<br />   </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=</span><span style="color: #800080;">$run_comm</span><span style="color: #000000;"> ;<br />   </span><span style="color: #0000ff;">if</span><span style="color: #000000;">( </span><span style="color: #000000;">/</span><span style="color: #800080;">$file_find_rex</span><span style="color: #000000;">/</span><span style="color: #000000;"> ){<br />     </span><span style="color: #800080;">$fileNum</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br />     </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/\</span><span style="color: #800080;">$filePath</span><span style="color: #000000;">/</span><span style="color: #800080;">$file_path</span><span style="color: #000000;">/</span><span style="color: #000000;">g;<br />     <br />     </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$_file_all_name</span><span style="color: #000000;">=</span><span style="color: #800080;">$File</span><span style="color: #000000;">::</span><span style="color: #000000;">Find</span><span style="color: #000000;">::</span><span style="color: #000000;">name;<br />     </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/\</span><span style="color: #800080;">$fileAllName</span><span style="color: #000000;">/</span><span style="color: #800080;">$_file_all_name</span><span style="color: #000000;">/</span><span style="color: #000000;">g;<br />     </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$_logic_file_all_name</span><span style="color: #000000;">=</span><span style="color: #800080;">$_file_all_name</span><span style="color: #000000;">;<br />           </span><span style="color: #800080;">$_logic_file_all_name</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/</span><span style="color: #800080;">$file_path</span><span style="color: #000000;">//</span><span style="color: #000000;">g;<br />         </span><span style="color: #800080;">$_logic_file_all_name</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/^\</span><span style="color: #000000;">s</span><span style="color: #000000;">*\.//</span><span style="color: #000000;">g;<br />     </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/\</span><span style="color: #800080;">$logicFileAllName</span><span style="color: #000000;">/\.\/</span><span style="color: #800080;">$_logic_file_all_name</span><span style="color: #000000;">/</span><span style="color: #000000;">g;<br />     </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #800080;">$_logic_file_all_name</span><span style="color: #000000;">=~/^</span><span style="color: #000000;">(</span><span style="color: #000000;">.*</span><span style="color: #000000;">)</span><span style="color: #000000;">\/</span><span style="color: #000000;">([</span><span style="color: #000000;">^\/</span><span style="color: #000000;">]</span><span style="color: #000000;">*</span><span style="color: #000000;">)</span><span style="color: #000000;">\.</span><span style="color: #000000;">([</span><span style="color: #000000;">^\.</span><span style="color: #000000;">]</span><span style="color: #000000;">*</span><span style="color: #000000;">)$</span><span style="color: #000000;">/</span><span style="color: #000000;">){<br />       </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$_logic_file_path</span><span style="color: #000000;">=</span><span style="color: #000000;">$</span><span style="color: #800000;">1</span><span style="color: #000000;">;<br />       </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$_logic_file_name</span><span style="color: #000000;">=</span><span style="color: #000000;">$</span><span style="color: #800000;">2</span><span style="color: #000000;">;<br />       </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">$_logic_file_exp</span><span style="color: #000000;">=</span><span style="color: #000000;">$</span><span style="color: #800000;">3</span><span style="color: #000000;">;<br />       </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/\</span><span style="color: #800080;">$logicFilePath</span><span style="color: #000000;">/\.\/</span><span style="color: #800080;">$_logic_file_path</span><span style="color: #000000;">/</span><span style="color: #000000;">g;<br />       </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/\</span><span style="color: #800080;">$logicFileName</span><span style="color: #000000;">/</span><span style="color: #800080;">$_logic_file_name</span><span style="color: #000000;">/</span><span style="color: #000000;">g;<br />       </span><span style="color: #800080;">$_tmp_run_comm</span><span style="color: #000000;">=~</span><span style="color: #000000;">s</span><span style="color: #000000;">/\</span><span style="color: #800080;">$logicFileExp</span><span style="color: #000000;">/</span><span style="color: #800080;">$_logic_file_exp</span><span style="color: #000000;">/</span><span style="color: #000000;">g;<br />       }<br />     </span><span style="color: #008000;">#</span><span style="color: #008000;">print $_tmp_run_comm,"\n";</span><span style="color: #008000;"><br /> </span><span style="color: #000000;">    </span><span style="color: #0000ff;">my</span><span style="color: #000000;"> </span><span style="color: #800080;">@return</span><span style="color: #000000;">=</span><span style="color: #0000ff;">eval</span><span style="color: #000000;">{</span><span style="color: #0000ff;">system</span><span style="color: #000000;">(</span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000; font-weight: bold;">$_tmp_run_comm 2>&1 \|echo \$\? </span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000;">)};</span><span style="color: #000000;"><br />     </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> ( </span><span style="color: #800080;">$return</span><span style="color: #000000;">[(</span><span style="color: #800080;">@return</span><span style="color: #000000;">-</span><span style="color: #800000;">1</span><span style="color: #000000;">)] </span><span style="color: #000000;">!=</span><span style="color: #000000;"> </span><span style="color: #800000;">0</span><span style="color: #000000;"> ) { <br />       </span><span style="color: #800080;">$log</span><span style="color: #000000;">-></span><span style="color: #0000ff;">log</span><span style="color: #000000;">(message</span><span style="color: #000000;">=></span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000; font-weight: bold;">success($fileNum):$_file_all_name</span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000;">);<br />        }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{<br />       </span><span style="color: #800080;">$log</span><span style="color: #000000;">-></span><span style="color: #0000ff;">log</span><span style="color: #000000;">(message</span><span style="color: #000000;">=></span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000; font-weight: bold;">error($fileNum):$_file_all_name</span><span style="color: #000000; font-weight: bold;">"</span><span style="color: #000000;">);<br />         }<br />   }<br />  }<br /> }<br /> <br /> <br /> find(</span><span style="color: #000000;">\&</span><span style="color: #000000;">fileThumb</span><span style="color: #000000;">,</span><span style="color: #800080;">$file_path</span><span style="color: #000000;">);<br /> </span></div> <br /> <img src ="http://m.tkk7.com/Skynet/aggbug/257374.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/Skynet/" target="_blank">鍒樺嚡姣?/a> 2009-03-02 17:51 <a href="http://m.tkk7.com/Skynet/archive/2009/03/02/257374.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title> soap (java,perl,瑕佸啓浠g爜 榪樹笉榪?100 char) http://m.tkk7.com/Skynet/archive/2009/03/02/257264.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Sun, 01 Mar 2009 16:00:00 GMThttp://m.tkk7.com/Skynet/archive/2009/03/02/257264.htmlhttp://m.tkk7.com/Skynet/comments/257264.htmlhttp://m.tkk7.com/Skynet/archive/2009/03/02/257264.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/257264.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/257264.html 鍙兘鏈綆鍗曠殑 soap 鍝︼紒
鏈嶅姟鍣ㄤ負 java tomcat
涓嬭澆鏈嶅姟鍣細http://www.apache.org/dist/ws/
   axis/ 涓簀ava
   axis-c/    涓?c

1.鎴戣繖涓嬭澆鐨?axis 1_4 鐗堟湰 錛岃В鍘?/webapps/axis  鏀懼埌 tomcat 鐨剋ebapps
鍚姩tomcat錛堣繖灝變笉淇敼浠諱綍錛屽鏈夐渶瑕?璇?web.xml 絳夐厤緗簡錛?a style="font-size: 12px;" onclick="NEBlog.gPrevBlog.oBlogList._oUpdownMenu.openBlog('blog/static/307422712007552499407', event);return false;"> 鍙傝?>>
    blog 涓?榪樻湁寰堝浠嬬粛 axis 澶у鍙互 鐪嬬湅  鏃ュ織 > 鍏朵笅鐨?"瀛︿範"

鐩存帴鍐欎釜鏂囦歡 HelloWorld.jws 鏀懼埌 %TOMCAT_HOME%"webapps"axis
public class HelloWorld {   
     
public String sayHello()   {   
     
return "HELLO soap!";    
 }    


絳変笉鍙?鍙互浣跨敤 鐪嬬湅
http://127.0.0.1:8080/axis/HelloWorld.jws?method=sayHello
緇撴灉 錛?br />
<soapenv:Envelope>
<soapenv:Body>
<sayHelloResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sayHelloReturn xsi:type="xsd:string">HELLO soap!</sayHelloReturn>
</sayHelloResponse>
</soapenv:Body>
</soapenv:Envelope>


瀹㈡埛孌?br /> perl cpan >> install  SOAP::Lite
#!perl -w
use SOAP::Lite;
print SOAP::Lite
    
-> proxy('http://127.0.0.1:8080/axis/HelloWorld.jws')
    
-> uri('http://127.0.0.1:8080/axis/HelloWorld.jws')
    
-> sayHello()
    
-> result;
緇撴灉錛?HELLO soap錛?/span>






]]>
Memcached 瀵硅瘽 Google ProtocolBuffers (perl)http://m.tkk7.com/Skynet/archive/2009/02/26/256804.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Thu, 26 Feb 2009 05:45:00 GMThttp://m.tkk7.com/Skynet/archive/2009/02/26/256804.htmlhttp://m.tkk7.com/Skynet/comments/256804.htmlhttp://m.tkk7.com/Skynet/archive/2009/02/26/256804.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/256804.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/256804.html
  鐪嬬湅鎴戣繖寮?web  緋葷粺鏋舵瀯鍥撅紝閭e氨鐭ラ亾 浣跨敤緇熶竴瀛樺偍鏍煎紡鐨勫ソ澶勪簡銆?br />   鍦ㄨ繖縐嶇粨鏋勪腑浣犲氨鍗曠函浣跨敤 java 錛屾垨 php 鏌愪竴縐嶅崟涓璇█鎻忚堪鏍煎紡錛屽瓨鍌ㄤ綘闆嗙兢浜や簰鐨勬暟鎹悧錛侊紵浣跨敤ProtocolBuffers 鍚э紝Google 宸茬粡鏈?鐜版垚鐨刟pi鏉ュ府浣犳墿灞曚簡銆?/strong>

鍙傝冿細
http://blog.csdn.net/lcj8/archive/2009/02/17/3900157.aspx




     浣滀負 Memcached 灝辨槸涓洪泦緹や嬌鐢紝閭d箞浣滀負鍦ㄧ紦瀛樺瓨鍌ㄧ殑鏁版嵁鎴戞兂涔熷簲璇ラ傜敤涓庡悇縐嶇幆澧冿紝榪欐椂鍊?鏁版嵁緇撴瀯鍗忚 Google ProtocolBuffers
鍙傝冿細http://code.google.com/apis/protocolbuffers/docs/overview.html
鍏朵粬璇█錛?/strong>http://code.google.com/p/protobuf/wiki/OtherLanguages
錛堝彲閫傜敤涓庡縐嶈璦錛?br />     javascript 璇誨彇緙撳瓨涓殑鏁版嵁 ,浣犲彲浠ユ兂璞′笅浣犵殑 web鏈嶅姟寮鍙?鐨勫皢鏉ワ紒錛?br />


鐩墠瀛︿範perl 涓?灝卞厛涓婁釜榪欑殑浠g爜錛?br /> 鍙傝冿細
http://search.cpan.org/~gariev/Google-ProtocolBuffers-0.08/lib/Google/ProtocolBuffers.pm#___top
#!/bin/perl -w
use Cache::Memcached;
use Google::ProtocolBuffers;
#寮鍚?memd
my $memd = new Cache::Memcached{servers => ['10.0.2.15:11211'] };

#澹版槑 緙撳瓨 瀛樺偍 protocol 鏍煎紡
my $key='test';
Google
::ProtocolBuffers->parse("
  message Person{
    required int32 id           =1;
    required string name        =2;
  }
",{create_accessors=>1});

my $data=Person->encode({
  id
=>123,
  name
=>'liukaiyi'
});

#緙撳瓨瀛樺偍
$memd->add($key =>$data,3600);

#######################################################################


my $memd = new Cache::Memcached{servers => ['10.0.2.15:11211'] };
my $person;{
  #浠庣紦瀛樹腑鍙栧嚭
  
$person = Person->decode($memd->get($key));
}

print $person->id,"-",$person->name;

 


緇撴灉錛?br />   123-liukaiyi




]]>
memcached 浣跨敤錛坧erl錛?/title><link>http://m.tkk7.com/Skynet/archive/2009/02/25/256642.html</link><dc:creator>鍒樺嚡姣?/dc:creator><author>鍒樺嚡姣?/author><pubDate>Wed, 25 Feb 2009 08:23:00 GMT</pubDate><guid>http://m.tkk7.com/Skynet/archive/2009/02/25/256642.html</guid><wfw:comment>http://m.tkk7.com/Skynet/comments/256642.html</wfw:comment><comments>http://m.tkk7.com/Skynet/archive/2009/02/25/256642.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/Skynet/comments/commentRss/256642.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/Skynet/services/trackbacks/256642.html</trackback:ping><description><![CDATA[  <br />   榪欏ぇ浣撲笂鍙互鐪嬪嚭錛屾湇鍔″櫒绔彛緙撳瓨鎶鏈?br /> <br />   memcached 瀹樻柟錛歨ttp://www.danga.com/memcached/<br />   瀹夎鍓嶏紝鍏堝畨瑁?<a >libevent</a><br />   鍏朵笂涓?linux 杞歡涓鑸畨瑁咃紝鐪嬩粬浠瑀eadme鏂囨。 <br />   $>memcached -d -u nobody -m 512 127.0.0.1 -p 11211<br />   <br />   濡傛灉鏈夊紓甯革紝<br />   <strong><span style="color: rgb(53, 24, 255);">ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2<br />   鍙傝?nbsp; </span></strong>http://blog.chinaunix.net/u2/70049/showart_1665279.html<br /> <strong><span style="color: rgb(53, 24, 255);">  </span></strong>鎴戣繖灝變嬌鐢?<strong>perl</strong> 璇█浜嗭紝<br />    鍏朵粬璇█鍙傝?http://code.google.com/p/memcached/wiki/Clients<br /> <br />    perl 浣跨敤 cpan> install <span style="color: rgb(0, 0, 0);">Cache</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">Memcached ;<strong>#浼氫嬌鐢?perl 鎴戝氨涓嶈浜?/strong></span><br /> 浠g爜璇存槑錛氫笉鍋滃 key 涓簍est 鐨勫艱繘琛岄掑   <br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">!/bin/perl -w</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 255);">use</span><span style="color: rgb(0, 0, 0);"> Cache</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">Memcached;<br /> <br /> </span><span style="color: rgb(0, 0, 255);">my</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$memd</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> new Cache</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">Memcached{servers </span><span style="color: rgb(0, 0, 0);">=></span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0); font-weight: bold;">127.0.0.1:11211</span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0);">] };<br /> </span><span style="color: rgb(0, 0, 255);">my</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$key</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0); font-weight: bold;">test</span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(128, 0, 128);">$memd</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">add(</span><span style="color: rgb(128, 0, 128);">$key</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">3600</span><span style="color: rgb(0, 0, 0);">) or </span><span style="color: rgb(0, 0, 255);">warn</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0); font-weight: bold;">Alread added</span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">){<br />   </span><span style="color: rgb(0, 0, 255);">print</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$memd</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">get(</span><span style="color: rgb(128, 0, 128);">$key</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0); font-weight: bold;">"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">\n</span><span style="color: rgb(0, 0, 0); font-weight: bold;">"</span><span style="color: rgb(0, 0, 0);">;<br />   </span><span style="color: rgb(128, 0, 128);">$memd</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">incr(</span><span style="color: rgb(128, 0, 128);">$key</span><span style="color: rgb(0, 0, 0);">) or </span><span style="color: rgb(0, 0, 255);">warn</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0); font-weight: bold;">FAIL!</span><span style="color: rgb(0, 0, 0); font-weight: bold;">'</span><span style="color: rgb(0, 0, 0);">;<br /> }</span><span style="color: rgb(0, 0, 0);"><br /> </span></div> <strong></strong> <br /> 浣跨敤 telnet 127.0.0.1 11211<br />      $> get  test <br />      VALUE test 0 2<br />      <strong><span style="color: rgb(248, 0, 0);">97</span></strong> <strong>#榪欏氨鏄垜浠掑鐨勫?褰撶劧浣犱嬌鐢ㄤ粈涔堣璦鍙栭兘鏄竴鏍風殑 <br /> </strong>     END <br /> <br /> <img src ="http://m.tkk7.com/Skynet/aggbug/256642.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/Skynet/" target="_blank">鍒樺嚡姣?/a> 2009-02-25 16:23 <a href="http://m.tkk7.com/Skynet/archive/2009/02/25/256642.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>perl file find http://m.tkk7.com/Skynet/archive/2009/02/23/256367.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Mon, 23 Feb 2009 15:55:00 GMThttp://m.tkk7.com/Skynet/archive/2009/02/23/256367.htmlhttp://m.tkk7.com/Skynet/comments/256367.htmlhttp://m.tkk7.com/Skynet/archive/2009/02/23/256367.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/256367.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/256367.htmluse File::Find;
use Time::Piece;


$timeOneDay = 86400;
$dayMultipler = 1;

$ByteCount = 0;
$fileAll = 0;
$fileJpg = 0;
$fileYes = 0;
$pathToTra = ".";

$gt = localtime;
$t1 = $gt->epoch;
find(
\&fileThumb, $pathToTra);
$gt = localtime;
$t2 = $gt->epoch;

print "Total KByte: ".($ByteCount/1024)."\n";
print "Total Scan:  ".$fileAll."\n";
print "Total Jpeg:  ".$fileJpg."\n";
print "Total Match: ".$fileYes."\n";
print "Total TimeCost: ".($t2-$t1)."\n";

sub fileThumb
{
   
$fileAll++;
   
if ((/.*\.jpg$/) )
   {   
      
$fileJpg++;
      
my $lt = 0;
      
$lt = localtime;

      
my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks= stat($_)  or die "Unable to stat $_\n";           
      
if ( $mtime < ($lt->epoch - $timeOneDay*$dayMultipler) )
      {
         
print "[ $fileYes ]"."$File::Find::name";
         
print $size." ".$ctime." ".$lt->epoch."\n";
         
$ByteCount += $size;
         
$fileYes++;
      }
   }
}



 



]]>
log4j perl 閿欒鏃ュ織鎻愬彇http://m.tkk7.com/Skynet/archive/2009/02/19/255445.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Thu, 19 Feb 2009 05:01:00 GMThttp://m.tkk7.com/Skynet/archive/2009/02/19/255445.htmlhttp://m.tkk7.com/Skynet/comments/255445.htmlhttp://m.tkk7.com/Skynet/archive/2009/02/19/255445.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/255445.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/255445.html 鏃ュ織
#!/bin/perl
use Encode ;
open(NOTESFILES,$ARGV[0]);

my %errorMeganotes;

print ">>>>>>>>>>>>>>",$ARGV[0],"<<<<<<<<<<\n";

while (<NOTESFILES>) {
  
if$_=~/^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})\s+ERROR\s+(.*)\s/g ){
     
if($errorMeganotes{$2}){
       
push @{$errorMeganotes{$2}},$1;
     }
else{
       
$errorMeganotes{$2}=[$1];
     }
  }
}

for(keys %errorMeganotes){
  
my $tmp_keys=$_;
  
my @tmp_array= @{$errorMeganotes{$tmp_keys}};
  
print "error number :>>",scalar(@tmp_array),"<<\n",encode("GBK",decode("UTF-8",$tmp_keys)),"\n",join(",\t",@tmp_array),"\n\n\n";
}


sh
#!/bin/sh
nowDate=$(date -'-1 day' +%Y-%m-%d);
echo $nowDate

perl 
/data/apps/shell/meganotesErrorLog.pl /data/apps/meganotes/tomcat/logs/app/app.log.$nowDate >  _tmp_$nowDate ;
perl 
/data/apps/shell/meganotesErrorLog.pl /data/apps/schedule/tomcat/logs/app/app.log.$nowDate  >> _tmp_$nowDate ;


mail 
-s $nowDate-ERROR-log  my@mail.com  <  _tmp_$nowDate;
rm _tmp_$nowDate ;

緇撴灉錛?br /> >>>>>>>/data/apps/meganotes/tomcat/logs/app/app.log.2009-02-18<<<<<<<<<
error number :>>2<<
MusicActionOpLogProxy:142 - music.popularTime=[Invalid field value for field "music.popularTime".]
2009-02-18 15:53:54,    2009-02-18 16:00:12
銆傘傘傘傘傘?br />




]]>
浣跨敤 awk 涓鏍?浣跨敤 perl 騫?濂瑰彲鐖辯殑姝e垯 http://m.tkk7.com/Skynet/archive/2009/02/17/255158.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Tue, 17 Feb 2009 09:39:00 GMThttp://m.tkk7.com/Skynet/archive/2009/02/17/255158.htmlhttp://m.tkk7.com/Skynet/comments/255158.htmlhttp://m.tkk7.com/Skynet/archive/2009/02/17/255158.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/255158.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/255158.html 鍙傝冿細
  http://my.huhoo.net/archives/2007/08/perl_1.html

綆鍗曠殑
   echo "tt" |perl  -ne  'print $_ '
澶氳
   find . -type f |perl  -ne  'print $1 $_ if $_=~ /(.*)flv/'
闄愬畾琛屾暟
   find . -type f |perl  -ne  'print $_ if $_=~ /.*flv/ && $tmp++<10 && $tmp>4'
    #褰撶劧shell>> find . -type f |grep ".*flv" |sed -n '5,10p' 鍜屼笂闈㈡槸涓鏍風殑
    # 涓嶈繃 浣犵湅閭?nbsp; 鍏朵腑浣跨敤 $1 絳夋鍒欓噸瀹氬悜 ,鍝堝搱
緇撴灉澶т綋涓?
./test3/0.flv
./flvplayer.swf
./test.flv
./0.flv




perl -h
  -e program        one line of program (several -e's allowed, omit programfile)
  -n                assume "while (<>) { ... }" loop around program
  -p                assume loop like -n but print line also, like sed






]]>
perl log4j 鍒嗘瀽鏃ュ織http://m.tkk7.com/Skynet/archive/2009/02/17/255116.html鍒樺嚡姣?/dc:creator>鍒樺嚡姣?/author>Tue, 17 Feb 2009 07:50:00 GMThttp://m.tkk7.com/Skynet/archive/2009/02/17/255116.htmlhttp://m.tkk7.com/Skynet/comments/255116.htmlhttp://m.tkk7.com/Skynet/archive/2009/02/17/255116.html#Feedback0http://m.tkk7.com/Skynet/comments/commentRss/255116.htmlhttp://m.tkk7.com/Skynet/services/trackbacks/255116.html
鏅氱殑 log4j 鏃ュ織 錛?br /> 褰撶劧 鐗規畩瑕佹眰 鐗規畩澶勭悊 銆?br />
#!/bin/perl
open(FILES,"/data/apps/schedule/tomcat/logs/app/app.log.2009-02-17");
while (<FILES>) {
    
next if !/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s+ERROR\s+/;
    
if($_=~/(.*-){3}(.*?):(.*)$/g){
        
$error{$2}++ ;
    }
elsif($_=~/(.*-){3}(.*)/g ){
        
$error{$2}++ ;
    } 
    銆傘傘傘傘?br />     }   
print "$_: $error{$_}\n" for(keys %error);

 java.net.SocketTimeoutException: 4
 test1 illegal!: 4
 cd illegal!: 4
 test2 illegal!: 4
 MusicAlbum not exists: 5
 Not Found Any File: 14
 java.net.ConnectException: 3
 Album not exists: 2
 銆傘傘?br />



]]>
主站蜘蛛池模板: 国产在线98福利播放视频免费| 亚洲精品无码久久| 亚洲av色影在线| 中文亚洲AV片在线观看不卡| 狠狠色婷婷狠狠狠亚洲综合 | 无码AV动漫精品一区二区免费| 亚洲AV无码一区二区三区久久精品| 久久精品国产亚洲AV蜜臀色欲| 亚洲精品福利你懂| 亚洲 欧洲 日韩 综合在线| 亚洲人成77777在线播放网站不卡 亚洲人成77777在线观看网 | 亚洲阿v天堂在线2017免费| 色哟哟国产精品免费观看| 一级做a爱过程免费视频高清| 成人嫩草影院免费观看| 久久高潮一级毛片免费| 免费国产成人午夜在线观看| 久久综合九色综合97免费下载| 99久9在线|免费| 一个人看的www在线观看免费| 在线观看人成网站深夜免费| 免费国产真实迷j在线观看| 亚洲日韩在线观看| 亚洲宅男永久在线| 激情五月亚洲色图| 老司机午夜性生免费福利| A国产一区二区免费入口| 免费无码又爽又刺激高潮视频| 国产香蕉免费精品视频| 麻豆国产入口在线观看免费| 亚洲av区一区二区三| 久久精品国产69国产精品亚洲| 亚洲色偷偷av男人的天堂| 亚洲天堂一区二区三区四区| 亚洲av永久无码精品秋霞电影秋| 九九久久国产精品免费热6| 久久久久成人精品免费播放动漫| 成年免费大片黄在线观看岛国| 免费va人成视频网站全| 亚洲Av无码精品色午夜| 香蕉大伊亚洲人在线观看|