text to html
Tony Pursell
ajp at princeswalk.fsnet.co.uk
Sat Jul 3 21:57:30 UTC 2010
On Sat, 2010-07-03 at 19:12 +0200, Jozsi Avadkan wrote:
> my own solution: http://pastebin.com/raw.php?i=kqQXCpD5
>
>
> > input:
> > http://pastebin.com/raw.php?i=MqPXZwc3
> >
> > output:
> > http://pastebin.com/raw.php?i=8QCkp4yv
> >
> > it will be a long day.. :D
> >
> > could someone please help with it?
> >
> > i have to make a "one liner" that get's the input, and gives the
> > mentioned output.
> >
>
I have done it with a gawk script. The command to run it is:-
gawk -f script.awk raw-input.txt > output.html
The script (which I have called script.awk) is:-
BEGIN { FS="/" ; SP="" }
{ if ($1 != D1 && NR != 1) print "<br>" }
{ if ($1 != D1 ) print "<br><font size=4>" $1 "</font><br>" }
{ if ($1 != D1 ) SP="" }
{ print SP "<a href=\"" $0 "\">" $0 "</a> " }
{ D1 = $1 }
{ SP = "| " }
Just shows how many ways there are to do things in Linux/Unix.
Tony
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100703/7b293402/attachment.sig>
More information about the ubuntu-users
mailing list