[Gllug] one-liner
Dimitrios Siganos
dimitris at siganos.org
Mon Oct 31 17:24:47 UTC 2011
IMO, a one-liner is not a well defined concept, hence, you can't say
that his solution is not a one liner unless you have provided a precise
definition for what a one liner is. It fits in one line, hence, it looks
like a one-liner to to me. If your colleague wanted a single command
solution then he should have been more specific.
What's more interesting is that his solution won't work correctly for
file-names which contain spaces.
Dimitris
On 31/10/11 16:57, tid 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?
>
> Tid
>
>
>
> --
> Gllug mailing list - Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20111031/45f6b6a9/attachment.html>
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list