D:\>perl -e "@F=<*.html>; foreach(@F){open IN,$_; print \"----------$_\n\"; while(<IN>){print if(m/1/);}; close IN;}" ----------test.html 4 spaces 1 space 2 tabs 1 tab ----------test2.html <h1>PerlTestBody</h1> D:\>
例えばこの例では"1"という文字が含まれている行を抜き出しているんだな。m//の中身を特定の文字に変えればいいんだな。
D:\>perl -e "@F=<*.html>; foreach(@F){open IN,$_; print \"----------$_\n\"; while(<IN>){print if(m/.*/);}; close IN;}" ----------test.html 4 spaces 1 space 2 tabs 1 tab ----------test2.html <html><head><title>PerlTest</title></head> <body> <h1>PerlTestBody</h1> <hr><p>AllAboutPerlOneLiner,SearchOn<a href="http://www.google.com">Google</a>WithSomeWords.Google'sLogo<img href="http://www.google.com" alt="GoogleLogo">IsHere.</p> <a href="http://www.google.com">Google</a> </body> </html> D:\>