SPUG: perl one-liner help

John W. Krahn krahnj at telus.net
Wed Apr 4 21:54:45 PDT 2007

Duane Blanchard wrote:
> Hi,


> This should be the simplest thing, but I'm not able to get it.
> I have a list of names in a file separated by a semicolon and a space:
> Starr, Ringo; McCartney, Paul; Lennon, John; Harrison, George;
> and I want to substitute each /; / with a /\n/.
> I'm running WinXP.
> perl -e "s/; /\n/" desktop/list.txt
> Thanks for any tips.

perl -F";\s+" -lane"print for @F"  desktop/list.txt

Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

More information about the spug-list mailing list