add another hard disk on Fedora Linux

Tim ignored_mailbox at yahoo.com.au
Mon Nov 21 15:04:22 UTC 2005


On Mon, 2005-11-21 at 13:33 +0000, Paul Howarth wrote:
> Something like this?
> 
> $ ls --full-time | awk 'NR == 1 { next } { printf "<a href=\"/images/%s\" title=%s><img src=\"/thumbnails/%s\"></a>\n", $9, $6, $9 }' >> index.html

Pretty much (just changed the title=%s bit to be title=\"%s\", to be on
the safe side), thanks. 

But just briefly...

I presume "NR == 1 { next }" means to iterate through the results until
the end of them.  But it's not too clear (from quickly going through the
awk man file, look up "NR" and "next").

Looking at the output from "ls --full-time" and the $9, $6 & $9, bits, I
presume that they mean to use the ninth, sixth, and ninth again, strings
returned from the ls command as the strings to be inserted where the
three %s variables are placed in the printf statements.


> Linux is full of tools for doing things like this. awk just happens
> to be my preference but lots of people would do it in perl.

Hmm, I was trying to figure out where to start.  There's a number of
programming languages around, and it did seem a bit like jumping in the
deep end to learn perl, or something similar to do something as simple
as this.  Looks like I have the fun task of reading up on how awk
works. 

-- 
Don't send private replies to my address, the mailbox is ignored.
I read messages from the public lists.




More information about the users mailing list