| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<CAEE75_2fVESHAT5ToX5uxFGu-Vfu_Ar4J-ijeWdLYFCRgodwcw@mail.gmail.com> |
Thanks for the warning, but yes: piping commands through a shell is
dangerous.
It's like crossing the street: if you're not careful, and children are
never careful enough, you'll eventually get badly hurt or even die. But
it's also like crossing the street in that it's really not that hard to
understand what to watch for, and soon becomes an autopilot thing.
It's even easy to completely automate on any decent system. `myeod=$(cat
/proc/sys/kernel/random/uuid); sed '...<<'$myeod'...\n'$myeod'\n...'`, (or
`xxd -l8 -g8 -p /dev/urandom` for the randomness if that's easier, or bang
on the home row for a bit, whatever you want) is how you do it when you
don't trust the dataset. But OP made the dataset herself. I'm pretty sure
she wasn't playing little bobby tables on herself.
And, by the way, speaking of reading things over carefully to avoid
unwanted consequences, go back and reread what I asked. Nobody older than
twelve thinks piping things through a shell is creative, that's not what
either dgoldman or I were talking about at all.
The best I thought could be said for `/start/!{H:$!d};x;1d` is it's a neat
twist on a little-known idiom, because I figured it had to be in the
oneliners file somewhere. I'm pretty sure I didn't even independently
invent it, I read it somewhere long ago and thought "hey, that's neat!".
All of that being what I meant to imply by my actual question, about the
actual subject of the question.
This being the sed list, and the sed part of what I posted being the
interesting part, we were talking about the sed part, and I didn't ask
_why_ that isn't in the oneliners file, I asked whether something like it
wasn't already there. Because I didn't invent it. And as I suspected the
basic trick does shows up in it, repeatedly.
Still, it's probably good to have a big red warning sign posted every so
often. I find that little "did you know" hints at startup or diffidently
offered at intervals can be very helpful.
Just, please, try not to overdo it. It's fairly annoying that I overdid
this reply so badsly, no? Less is better.
[Non-text portions of this message have been removed]