Mailinglist Archive: opensuse (818 mails)

< Previous Next >
Re: [opensuse] Java script assistance (slightly OT)
Hello,

On Thu, 22 Sep 2011, Dave Howorth wrote:
David Haller wrote:
[..]
With '\+' it's analoguous (and \+ is not portable, IIRC, but
available in GNU sed for at least 10 years, I think). Again: 'man 7
regex' should clear up most of your misunderstandings. But feel free
to ask for further clarifications / explanations (esp. where shell
quoting/escaping is involved, that can get quite confusing ;)

[snip] If you don't, you might get confused by "what's escaped from
the shell and what for sed/grep ...

This reminds me of why I like Perl. Sure its ugly and complicated but at
least its just one sort of ugly for everything!

There's an easy workaround: use sed- or awk-scripts. E.g.:

,----[ ~/bin/delcomments ]
| #!/usr/bin/sed -f
| /^[[:space:]]*#/d
| /^[[:space:]]*$/d
`----
or
,----[ ~/bin/headntail ]
| #!/usr/bin/gawk -f
[..]
`----

No worries about escaping/quoting in those scripts ;)

To be fair, you'd have to compare to 'perl -e' oneliners. And you get
the same problems there re quoting/escaping as with sed or awk. Put
the stuff into a file and run that, I'm a happy bunny, whether using
sed, awk or perl.

I do prefer perl most of the time, esp. with a 'system' wrapper ;)

-dnh

--
What is that fluff that persistantly gathers in the bottom corner of
my wardrobe?
And in response, thus spake the Oracle:
} Moths that died laughing. [#1350-05]
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >