[Gllug] C and Unix pioneer Dennis Ritchie reported dead

Duane Griffin duaneg at dghda.com
Mon Oct 31 17:38:10 UTC 2011


On 31 October 2011 16:57, tid <td at bloogaloo.co.uk> wrote:
> A colleague asked my opinion as to whether I felt the following was a
> correct answer to an test question:
>
>   Q: Please supply a one-line command to substitute all occurences of 'fish'
> to 'chips' in all files ending in .html
>
>  -A: $ for i in *.html ; do sed -i -e 's/fish/chips/g' $i ; done
>
> I'm not sure about this : it's written on one line but it's not really a
> one-liner or is it? The point of the test is
> measure the student's skill and they've shown that they understand in-place
> editing so I'm inclined
> to give them the point. What do others think?

I'd say it qualifies as a one-liner, personally.

However I'd still not give full marks as it won't recurse into
sub-directories and it won't handle filenames with spaces.

> Tid

Cheers,
Duane.

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan
--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list