in reply to Re: regular expessions question: (replacing words)
in thread regular expessions question: (replacing words)
Thanks, $new_guy#!usr/bin/perl my $FILENAME4 = "organized.txt"; open(DATA2, $FILENAME4); #remove all previous re-organized files my $remove_reorganized = "re-organized.txt"; if (unlink($remove_reorganized) == 1) { print "Existing \"re-organized.txt\" file was +removed\n"; } #now make a file for the ouput my $outputfile = "re-organized.txt"; if (! open(POS, ">>$outputfile") ) { print "Cannot open file \"$outputfile\" to write to!!\n\n" +; exit; } while (my $organized = <DATA2>) { #do some re-organizing #sort out the group numbers first $organized =~ s/(\w+)[^(^\d+)(\s)]/z/g; my $organized2 = $organized; $organized2 =~ s/z(\d+)/z/g; print POS $organized2; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: regular expessions question: (replacing words)
by jethro (Monsignor) on Sep 27, 2010 at 14:07 UTC | |
|
Re^3: regular expessions question: (replacing words)
by jwkrahn (Abbot) on Sep 27, 2010 at 14:34 UTC | |
|
Re^3: regular expessions question: (replacing words)
by toolic (Bishop) on Sep 27, 2010 at 12:59 UTC | |
|
Re^3: regular expessions question: (replacing words)
by JavaFan (Canon) on Sep 27, 2010 at 12:51 UTC | |
by $new_guy (Acolyte) on Sep 27, 2010 at 14:04 UTC | |
by jethro (Monsignor) on Sep 27, 2010 at 14:59 UTC | |
by $new_guy (Acolyte) on Sep 28, 2010 at 07:28 UTC | |
by jethro (Monsignor) on Sep 28, 2010 at 22:44 UTC |