Re: sed syntex in procmailrc question
Harry Putnam <[email protected]>
| Newsgroups | gmane.mail.procmail |
|---|---|
| Organization | Still searching... |
| Message-ID | <[email protected]> |
Bart Schaefer <[email protected]> writes: > To expand just a little on Harry's correct explanation: > > In the literal example you included, the single quotes around > 's/SUBJET/' are unnecessary. You only need quotes to protect spaces, > dollar signs, and globbing characters like *?[]. > > However, my guess is that your real sed expression, which you have not > shown us, doesn't have the string SUBJET but instead has a complex > string that might contain some of those special characters that need > quoting. > > In that case for clarity I might have written such an expression as > > sed -e s/'The Real String Goes Here'/"$SUBJ"/g > > rather than butting the two sets of quotes up against each other. Again no expert here but let me move off sed for a moment since I'm more familiar with awk. Aren't there cases with awk where spaces are not the issue but allowing a shell Variable to expand are what matters? For example if you have a variable say, in the environment. And you want it to expand inside some awk code in .procmailrc. Wouldn't you need to do something like awk '/somestring/{print $0"'$MY_ENV_VAR'"}' Where in effect you are stopping the awk code to allow the expansion and then taking it up again. I realize there are other constructs that would serve the same purpose and avoid quoting quagmires like: awk -v var=$MY_ENV_VAR '{print var}' But I'm just thinking there are usages where single quotes are used for something besides spaces.