<div class="gmail_quote">On Sat, Jul 3, 2010 at 2:07 AM, Jozsi Avadkan <span dir="ltr"><<a href="mailto:jozsi.avadkan@gmail.com">jozsi.avadkan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
input:<br>
<a href="http://pastebin.com/raw.php?i=MqPXZwc3" target="_blank">http://pastebin.com/raw.php?i=MqPXZwc3</a><br>
<br>
output:<br>
<a href="http://pastebin.com/raw.php?i=8QCkp4yv" target="_blank">http://pastebin.com/raw.php?i=8QCkp4yv</a><br>
<br>
it will be a long day.. :D<br>
<br>
could someone please help with it?<br>
<br>
i have to make a "one liner" that get's the input, and gives the<br>
mentioned output.<br>
<br></blockquote><div>First, I'm not really sure you want the exact output you posted.<br>1)  The second and third href="..." elements after "netbsd" seem to be different from all the other multi-line groups.  Could this be a typo?<br>
2)  The pipe symbol ("|") at the end of most groups also seems a bit odd.  I would guess the last of each group<br>would not want one, as is the case with the first group.<br><br>Second, perl is my tool of choice for this sort of thing, and if you can tolerate longer lines than usual, it can be made a one-liner.  This version puts pipe ("|") after all links, but does not treat netbsd specially.  I'm assuming that your shell is BASH. The quoting might need to be different in other shells.<br>
<br>perl -n -e '$od=qq+/+; while (<>) { chomp; ($dir, $stuff)=split /\//, $_, 2; @all = split /\//, $_; $thing = $all[$#all]; $thing =~ s/\.html$//; if ($dir ne $od) { print qq+<br>\n+ if $od ne qq+/+; $od = $dir; print qq+<br><font size=4>$dir</font><br>\n+; } print qq:<a href="$dir/$stuff">$thing</a> | \n: } print qq+\n+;'<br>
<br></div></div> This really is a one-liner, so I've also attached it as a file in case 
mail software creates line breaks.  If you can tolerate it as a separate script, a multi-line version would be much more readable.<br>
<br>I still use Perl a lot for short things like this, even though it's one of the less-readable languages I know.  I've moved on to Python for most of the stuff I used to use Perl for, because I can read the code a year later.<br clear="all">
<br>-- <br>Kevin O'Gorman, PhD<br><br>