Daily Script6

2022-07-09 23:40:49 浏览数 (1)

[perl]

#模拟交互

代码语言:javascript复制
[root@iZ23n5z6svlZ ~]# perl -e 'print "==>";while(<STDIN>){eval($_);print "n==>";}'
==>$a="lala";

==>print $a."n";
lala

==>

#one line program

代码语言:javascript复制
perl -lne 'print $1 if (/(bS mapS b)/)' tm |grep srw | sort -u
cat jjkk  | grep -E 'Hostname:|Function:'| perl -nle 'print $1.$2 if(/(Hostname:|ID:|Function:|Description:|Test URI:|Ping Test:|Nukit:|ValidateInternals:|Special:|Rank:|Bladecenter:).*>([^<>] )(</w >) $/) '| sed 's/&nbsp;//'
cat jjkk  | grep -E 'Hostname:|ID:|Function:|Description:|Test URI:|Ping Test:|Nukit:|ValidateInternals:|Special:|Rank:|Bladecenter:'| perl -nle 'print $1.$2 if(/(Hostname:|ID:|Function:|Description:|Test URI:|Ping Test:|Nukit:|ValidateInternals:|Special:|Rank:|Bladecenter:).*>([^<>] )(</w >) $/) '
perl -nle 's/(^s |s $)//g;print $_ unless (/^$/)' jk
perl -nle 's/(^s |s $)//g;' -e  'print $_ unless (/^$/)' jk
perl -i.bak  -p -e 'BEGIN{$flag=2}  if (/^~~~/ and $flag == 2) {s/^~~~/startflag/ ; $flag=3 } ; if (/^~~~/ and $flag == 3) {s/^~~~/endflag/ ; $flag=2 }'   jk.md

[paste]

代码语言:javascript复制
cat u |cut -c 2-11 > time_s
paste <(for i in `cat time_s`; do date -d "1970-01-01 UTC $i seconds"  "%x %X%z %Z" ; done)  <(cat u)

[exec]

代码语言:javascript复制
exec 8>u.log1
exec 9>u.log2
ll /proc/self/fd

0 人点赞