はグレップを使用して、次のコマンドライン出力を考えてみましょう:はgrepのためのPerlの交換を使用してファイル名を保持するために、どのように
[[email protected]]$ find . -name "*.php" | xargs grep __construct | tail
./ilserverd/src/php/ImageLoopIntegrationService.php: public function __construct($input, $output=null) {
./ilserverd/src/php/ImageLoopIntegrationService.php: public function __construct($vals=null) {
./ilserverd/src/php/ImageLoopIntegrationService.php: public function __construct($vals=null) {
./ilserverd/src/php/ImageLoopIntegrationService.php: public function __construct($vals=null) {
./ilserverd/src/php/ImageLoopIntegrationService.php: public function __construct($vals=null) {
./ilserverd/src/php/ImageLoopIntegrationService.php: public function __construct($handler) {
./ilserverd/src/php/il_server_types.php: public function __construct($vals=null) {
./ilserverd/src/php/il_server_types.php: public function __construct($vals=null) {
./utilities/studio/legacy/full_bleed_update_photobook_themes.php: public function __construct() {
./utilities/studio/legacy/full_bleed_update_photobook_themes.php: parent::__construct();
これは、コンストラクタの引数を抽出しようとしているの私の最初のステップであり、そしてそれは、ステップ数が必要になりますので、 、私はgrepの改良としてPerlを使用しようとしています。しかし、まず、ファイル名を保持して、最終的な "レポート"出力のものを参照することができます。
しかし、次のPerlの1ライナーに切り替えると、ファイル名は出力に含まれなくなります。どうすればそれらを保持し、grepのコマンドラインの代わりにPerlを使用することができますか?
[[email protected]]$ find . -name "*.php" | xargs perl -wnl -e '/__construct/ and print' | tail
public function __construct($input, $output=null) {
public function __construct($vals=null) {
public function __construct($vals=null) {
public function __construct($vals=null) {
public function __construct($vals=null) {
public function __construct($handler) {
public function __construct($vals=null) {
public function __construct($vals=null) {
public function __construct() {
parent::__construct();
http://search.cpan.org/perldoc?perlvar#ARGV – mob