From: Janis Papanagnou on 2 Mar 2010 13:18 pk wrote: > Janis wrote: > >> BTW, I wonder why you said upthread >> >>>>> "I was thinking of something more shell-ish [...]" >> and prefer shell loops and in this case quite bulky shell code. > > Don't get me wrong: awk is perfectly fine (no, I don't want to start the > debate "shell loops vs. dedicated tools" again). Don't get _me_ wrong... :-) I'm not the least convinced about a radical "avoid shell loops" paradigm and (mostly) abstain from those discussions. Though, just in this case, it looked so apparently bad; an implicit awk loop and another subsequent (and unnecessary in this case) shell loop, iterating more often over the same data than necessary. Janis > > [...]
From: pk on 2 Mar 2010 13:31 Janis Papanagnou wrote: >>>>>> "I was thinking of something more shell-ish [...]" >>> and prefer shell loops and in this case quite bulky shell code. >> >> Don't get me wrong: awk is perfectly fine (no, I don't want to start the >> debate "shell loops vs. dedicated tools" again). > > Don't get _me_ wrong... :-) > > I'm not the least convinced about a radical "avoid shell loops" paradigm > and (mostly) abstain from those discussions. Though, just in this case, > it looked so apparently bad; an implicit awk loop and another subsequent > (and unnecessary in this case) shell loop, iterating more often over the > same data than necessary. I might even agree; my point was that, *having the code developed that way for some reason (good or bad doesn't matter here) up to that point*, my train of thought led me to ask the question I asked, because at that point I was curious.
From: Janis Papanagnou on 2 Mar 2010 13:51 pk wrote: [...] > > I might even agree; my point was that, *having the code developed that way > for some reason (good or bad doesn't matter here) up to that point*, my > train of thought led me to ask the question I asked, because at that point I > was curious. I understood your thought, and I certainly didn't mean to offend you in any way; you know that, I'm sure. :-) Janis
From: pk on 2 Mar 2010 13:48 Janis Papanagnou wrote: > pk wrote: > [...] >> >> I might even agree; my point was that, *having the code developed that >> way for some reason (good or bad doesn't matter here) up to that point*, >> my train of thought led me to ask the question I asked, because at that >> point I was curious. > > I understood your thought, and I certainly didn't mean to offend you in > any way; you know that, I'm sure. :-) Sure, no worries :)
From: Javi Barroso on 2 Mar 2010 14:09 On Mar 2, 10:09 am, pk <p...(a)pk.invalid> wrote: > Janis Papanagnou wrote: > >> works, but I have the impression that I'm overcomplicating it. However, I > >> cannot find a simpler way. Any suggestion? > > > awk '{ print | "command" } > > /^END$/ { close("command") }' > > Yes, thanks (and to Bill). I was thinking of something more shell-ish rather > than calling external commands in awk, but that'll do. > > Thank you! what about using eval ? eval "$(awk ' !/END/ { input=input$0"\n"; } /END/ { printf "printf \"%s\" | command ;", input; input=""; } ')" Or this command is an evil command ? :) http://mywiki.wooledge.org/BashFAQ/048 Regards,
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Escaping regexp meta characters Next: wget, forms, password, cookies |