Prev: GNU Parallel 20100722 released
Next: ulimit question
From: Chris F.A. Johnson on 9 Aug 2010 15:30 On 2010-08-09, Kenny McCormack wrote: > In article <i2cf5j$982$1(a)south.jnrs.ja.net>, > Andrew McDermott <a.p.mcdermott(a)rl.ac.uk> wrote: >>Kenny McCormack wrote: >> >>> In article <MP6dneh2BdV5CdTRnZ2dnUVZ_sydnZ2d(a)giganews.com>, >>> hehe2046 <user(a)compgroups.net/> wrote: >>>>I would say: sed -i "s/.*/'&',/" input.txt >>>> >>>> >>> >>> Or, more sensibly: >>> >>> awk '{print "\047"$0"\047"}' ... >> >>You missed the comma, by the way. >>> >>> Tip: Avoid cryptic, meaningless tools like "sed" (and friends). >>> >> >>How is 'print "\047"$0"\047" less cryptic than the above sed line? >> >>Sorry, I don't want to start an awk V sed flame war, but let's face it, that >>so-called tip IS flame-bait. >> >>Andrew > > My point was that it is better to learn to use a tool that is likely to > help you more down the line. I learned AWK pretty much as my first > tool, and never really bothered with sed/join/comm/tr/etc. I think we > do people a disservice by giving them sed/join/comm/tr/etc solutions. It is better to learn the right tool for the job. To use awk to replace join/comm/tr/etc. requires coding when a simple command would suffice. For simple substitutions (and even some more complex ones), sed is just as comprehensible as awk. -- Chris F.A. Johnson, author <http://shell.cfajohnson.com/> =================================================================== Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
From: John Kelly on 9 Aug 2010 15:46 On Mon, 9 Aug 2010 19:30:45 +0000 (UTC), "Chris F.A. Johnson" <cfajohnson(a)gmail.com> wrote: >On 2010-08-09, Kenny McCormack wrote: >> My point was that it is better to learn to use a tool that is likely to >> help you more down the line. I learned AWK pretty much as my first >> tool, and never really bothered with sed/join/comm/tr/etc. I think we >> do people a disservice by giving them sed/join/comm/tr/etc solutions. > > It is better to learn the right tool for the job. > To use awk to replace join/comm/tr/etc. requires coding when a > simple command would suffice. I prefer minimal solutions, using the least capable tool that will solve the problem. -- Web mail, POP3, and SMTP http://www.beewyz.com/freeaccounts.php
From: Kenny McCormack on 9 Aug 2010 16:07 In article <i3pl14$i1m$1(a)news.eternal-september.org>, Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote: .... > To use awk to replace join/comm/tr/etc. requires coding when a > simple command would suffice. > > For simple substitutions (and even some more complex ones), sed is > just as comprehensible as awk. Obviously, I disagree. I think it is better to learn a tool and use that tool. Why bother your head with stupid, virtually useless tools? But I guess we can agree to disagree. -- "The anti-regulation business ethos is based on the charmingly naive notion that people will not do unspeakable things for money." - Dana Carpender Quoted by Paul Ciszek (pciszek at panix dot com). But what I want to know is why is this diet/low-carb food author doing making pithy political/economic statements? But the above quote is dead-on, because, the thing is - business in one breath tells us they don't need to be regulated (that they can morally self-regulate), then in the next breath tells us that corporations are amoral entities which have no obligations to anyone except their officers and shareholders, then in the next breath they tell us they don't need to be regulated (that they can morally self-regulate) ...
From: Grant on 9 Aug 2010 16:58 On Mon, 9 Aug 2010 20:07:34 +0000 (UTC), gazelle(a)shell.xmission.com (Kenny McCormack) wrote: >In article <i3pl14$i1m$1(a)news.eternal-september.org>, >Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote: >... >> To use awk to replace join/comm/tr/etc. requires coding when a >> simple command would suffice. >> >> For simple substitutions (and even some more complex ones), sed is >> just as comprehensible as awk. > >Obviously, I disagree. I think it is better to learn a tool and use >that tool. Why bother your head with stupid, virtually useless tools? I learned awk, stopped using the cut, sed and friends simply because awk is easier for me to remember ;) Sometimes efficiency is getting the job at hand done, accurately, not optimally unless there's other factors force use of a particular tool. > >But I guess we can agree to disagree. Of course :) Grant.
From: Kenny McCormack on 9 Aug 2010 17:07
In article <5lq066p5a4b9l2dp644r4dvvgobgh5aacg(a)4ax.com>, Grant <omg(a)grrr.id.au> wrote: >On Mon, 9 Aug 2010 20:07:34 +0000 (UTC), gazelle(a)shell.xmission.com >(Kenny McCormack) wrote: > >>In article <i3pl14$i1m$1(a)news.eternal-september.org>, >>Chris F.A. Johnson <cfajohnson(a)gmail.com> wrote: >>... >>> To use awk to replace join/comm/tr/etc. requires coding when a >>> simple command would suffice. >>> >>> For simple substitutions (and even some more complex ones), sed is >>> just as comprehensible as awk. >> >>Obviously, I disagree. I think it is better to learn a tool and use >>that tool. Why bother your head with stupid, virtually useless tools? > >I learned awk, stopped using the cut, sed and friends simply because awk >is easier for me to remember ;) Sometimes efficiency is getting the job >at hand done, accurately, not optimally unless there's other factors >force use of a particular tool. Well put, sir! >>But I guess we can agree to disagree. > >Of course :) > >Grant. We agree! -- Faced with the choice between changing one's mind and proving that there is no need to do so, almost everyone gets busy on the proof. - John Kenneth Galbraith - |