<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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.<br>
<br>
What's more interesting is that his solution won't work correctly
for file-names which contain spaces.<br>
<br>
Dimitris<br>
<br>
On 31/10/11 16:57, tid wrote:
<blockquote
cite="mid:CADRrasy2vxNH4GxbUYWtRNv0cAw2dhTrC=-gV0-dMCAsQJTQsg@mail.gmail.com"
type="cite">A colleague asked my opinion as to whether I felt the
following was a correct answer to an test question: <br>
<br>
Q: Please supply a one-line command to substitute all occurences
of 'fish' to 'chips' in all files ending in .html<br>
<br>
-A: $ for i in *.html ; do sed -i -e 's/fish/chips/g' $i ; done<br>
<br>
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 <br>
measure the student's skill and they've shown that they understand
in-place editing so I'm inclined <br>
to give them the point. What do others think? <br>
<font color="#888888"><br>
Tid</font><br>
<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
--
Gllug mailing list - <a class="moz-txt-link-abbreviated" href="mailto:Gllug@gllug.org.uk">Gllug@gllug.org.uk</a>
<a class="moz-txt-link-freetext" href="http://lists.gllug.org.uk/mailman/listinfo/gllug">http://lists.gllug.org.uk/mailman/listinfo/gllug</a>
</pre>
</blockquote>
<br>
</body>
</html>