Category: | text processing |
Author/Contact Info | hash h4sh@globo.com |
Description: | Code usefull to edit files automaticly removing the last "." in the selected string lines. |
#!/usr/bin/perl # Get files and skip "." in the selected strings. # jeffa is right. killlastdot.pl :) # Usage: ./killlastdot <ENTER> file word my $FILE = <STDIN> ; chop $FILE ; my $VAR = <STDIN> ; chop $VAR ; open(GETARQ, "$FILE") ; my @ARQ = <GETARQ> ; close(GETARQ) ; foreach (@ARQ) { if ($_=~/$VAR/) { my $x = $_ ; chop($x) ; chop($x) ; print "$x\n" ; } else { print $_ ; } } |
Back to
Code Catacombs