[Classiccity-pm] substitutions

Stephen Howard stephen at enterity.com
Tue May 9 12:20:59 PDT 2006


well, since this is a perl list and not a sed list I can't give you any 
sed tips, but you might try something like (untested):

open my $file, '<', $ARGV[0] or die $!;

while( my $line = <$file> ) {
     $line =~ s/\s+/\n/g;
     print $line;
}

and then call it as

perl myscript.pl fileA > fileB

-Stephen

Linda Dubes Law wrote:
> I have a file that has a bunch of lines in it with emails.  Sometimes there is one email per line and others there are up to 6 emails per line.  I want one email address per line.  Since there is a space between all email addresses, I thought I could do a simple substitute of the space with a new line.  
> 
> system ('sed "s/ /\n/g" fileA > fileB');
> 
> This does not seem to work well for me.  It removed the spaces but does not add the new line.  
> 
> Any ideas for a better way of doing this?  
> 
> Thanks 
> 
> Linda
> 
> _______________________________________________
> Classiccity-pm mailing list
> Classiccity-pm at pm.org
> http://mail.pm.org/mailman/listinfo/classiccity-pm



More information about the Classiccity-pm mailing list