Date: Sat, 3 Jul 2010 07:06:35 -0700 From: George Davidovich <freebsd@optimis.net> To: freebsd-questions@freebsd.org Subject: Re: text to html Message-ID: <20100703140635.GA92580@marvin.optimis.net> In-Reply-To: <1278148049.4480.9.camel@localhost> References: <1278148049.4480.9.camel@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 03, 2010 at 11:07:29AM +0200, Jozsi Avadkan wrote: > 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. A one-liner, huh? LOL. Add semi-colons? The following should accomplish what you want. #!/bin/sh sample_data="\ debian/hosts/hosts.html debian/use-other-users-when-using-wine-eg-dude.html debian/java-chromium-etc.html dns/dns-server-szakszon-mihaly-hungarian.html netbsd/sshd.html netbsd/installing-removing-programs.html netbsd/install-from-pendrive/install-from-pendrive.html openwrt/wrt160nl/wrt160nl-flash.html routeros/home-soho-router.html routeros/turn-off-watchdog.html" seen='nothing_to_see_yet_move_along' echo "$sample_data" | while read target; do topic=${target%%/*} # debian/hosts/hosts.html -> debian filename=${target##*/} # debian/hosts/hosts.html -> hosts.html title=${filename%.*} # hosts.html -> hosts if [ $topic = $seen ]; then echo " | <a href=\"${target}\">${title}</a>" else echo "<br> <br> <font size=4>${topic}</font> <br>" echo " <a href=\"${target}\">${title}</a>" fi seen=$topic done -- George
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100703140635.GA92580>