From lindadl at uga.edu Mon May 8 08:54:52 2006 From: lindadl at uga.edu (Linda Dubes Law) Date: Mon, 8 May 2006 11:54:52 -0400 Subject: [Classiccity-pm] substitutions Message-ID: <20060508115452812.00000004272@lindadl> 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 From stephen at enterity.com Tue May 9 12:20:59 2006 From: stephen at enterity.com (Stephen Howard) Date: Tue, 09 May 2006 15:20:59 -0400 Subject: [Classiccity-pm] substitutions In-Reply-To: <20060508115452812.00000004272@lindadl> References: <20060508115452812.00000004272@lindadl> Message-ID: <4460EB9B.9020608@enterity.com> 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