or maybe you want a one-liner:while(<>){ print "$1;\n" if /^(Key [0-5] 0x[\da-f]{14})/i; } while( my $line = <>){ if( my ($match) = $line =~ /^(Key [0-5] 0x[\da-f]{14})/i ){ print "$match;\n"; } }
This will change "file.txt".perl -ni -le 'print "$1;" if /^(Key [0-5] 0x[\da-f]{14})/i' file.txt
In reply to Re: manipulating file contents
by lidden
in thread manipulating file contents
by monkey-
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |