Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Perl splitting help


George Vieira <georgev@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> 1. Grab a file containing a list of people and phone numbers seperated by a
> | .eg.

> --- playlist.txt---
> George Vieira|0410123123
> Another Person|0414321321

> 2. Split the lines into fields so I can print each field into a cell in a
> table.

Try this AWK script:

#!/usr/bin/awk -f

BEGIN {
	FS = "|"
}

{
	print "  <tr>"
	print "   <td>" $1 "</td>"
	print "   <td>" $2 "</td>"
	print "  </tr>"
}
-- 
Debian GNU/Linux 2.1 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt