Mike Blezien wrote:
> 
> Hello all,

Hello,

> I know this probably very simple and I've overlooked the obvious here, but I
> have a flat file containing categories:
> 
> Animations
> Backgrounds
> Buttons
> Clip_Art
> Dividers-Bars
> Flash
> Fonts
> Icons
> Interfaces
> Member_Tools
> Names
> Photos
> Presentations
> Screen_Savers
> Templates
> Textures
> Wallpaper
> 
> Now what I am trying to do, is to read the file, the re-format the output to
> have every 3 categories on one line, separated by a space, then each line end
> with a <P>, IE:
> 
> Animations Backgrounds Buttons<P>
> Clip_Art Dividers-Bars Flash<P>
> ... etc....

$ cat test.txt
Animations
Backgrounds
Buttons
Clip_Art
Dividers-Bars
Flash
Fonts
Icons
Interfaces
Member_Tools
Names
Photos
Presentations
Screen_Savers
Templates
Textures
Wallpaper
$ perl -pe'++$a%3?y/\n/ /:s/$/<P>/' test.txt
Animations Backgrounds Buttons<P>
Clip_Art Dividers-Bars Flash<P>
Fonts Icons Interfaces<P>
Member_Tools Names Photos<P>
Presentations Screen_Savers Templates<P>



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to