m8ta
You are not authenticated, login. |
|
{91} | ||
to remove lines beginning with a question mark (e.g. from subversion) svn status | perl -nle 'print if !/^?/' here's another example, for cleaning up the output of ldd: ldd kicadocaml.opt | perl -nle '$_ =~ /^(.*?)=>/; print $1 ;' and one for counting the lines of non-blank source code: cat *.ml | perl -e '$n = 0; while ($k = <STDIN>) {if($k =~ /\w+/){$n++;}} print $n . "\n";' By that metric, kicadocaml (check it out!), which I wrote in the course of learning Ocaml, has about 7500 lines of code. Here is one for resizing a number of .jpg files in a directory into a thumb/ subdirectory: ls -lah | perl -nle 'if( $_ =~ /(\w+)\.jpg/){ `convert $1.jpg -resize 25% thumb/$1.jpg`;}'or, even simpler: ls *.JPG | perl -nle '`convert $_ -resize 25% thumb/$_`;' Note that -e command line flag tells perl to evaluate the expression, -n causes the expression to be evaluated once per input line from standard input, and -l puts a line break after every print statement. reference For replacing charaters in a file, do something like: cat something | perl -nle '$_ =~ s/,/\t/g; print $_' | ||
{810} |
ref: -0
tags: circular polarized antenna microstrip ultrawideband
date: 02-03-2010 21:30 gmt
revision:1
[0] [head]
|
|
excellent! Ultra-wideband circular polarized microstrip archimedean spiral | ||
{384} | ||
notes on reading magstripe cards:
|