On 06/04/2021 05.18, David T-G wrote:
Carlos, et al --
...and then Carlos E. R. said... % % On 06/04/2021 03.54, David Haller wrote: % >Hello, % > % >On Tue, 06 Apr 2021, Carlos E. R. wrote: % >>On Tuesday, 2021-04-06 at 00:40 +0200, David Haller wrote: % >>>On Mon, 05 Apr 2021, Carlos E. R. wrote: % >>>>grepmail -h ^Message-[Ii][dD].*"$MSGID" ~/Mail/_Lists/_filed/os-en.2007* ... % >>>$ grepmail -h "^Message-[Ii][Dd].*${MSGID//$/\\$}" \ % >>> ~/Mail/_Lists/_filed/os-en.2007* % >> % >>I don't understand how, but it works :-D
First, props to dnh for the wicked awesome var munging :-)
Hats off :-)
... % % It is the worst kind of string to grep for in bash. The separators % are '<' and '>', used for redirection. There are ''', '+', '$' and % who knows what more. [snip]
Indeed. Ugh.
But you're working in a pretty limited universe, and you aren't likely to come across a lot of near-duplicates. Why not just change
davidtg@gezebel:~> for MSGID in \ '<006501c7b50e$77cc3630$6764a290$@com>' \ '<2md$yDk+qZbGFwuq@dev.null.davjam.org>' \ '<8993-Fri29Jun2007142734+0100-jpff@codemist.co.uk>' do echo $MSGID | tr '<>$+' '.' ; done .006501c7b50e.77cc3630.6764a290.@com. .2md.yDk.qZbGFwuq@dev.null.davjam.org. .8993-Fri29Jun2007142734.0100-jpff@codemist.co.uk.
all of those ugly chars to . as each single placeholder?
Now that's a nice out of the box thinking!! :-D :-O
Something like
MSGID_CLEAN=`echo $MSGID | tr '<>$+' '.'` grepmail -h "^Message-[Ii][Dd].*$MSGID_CLEAN" ~/Mail/_Lists/_filed/os-en.2007*
or so. [Yes, I know there are sexier ways to munge, but this may be more easily handled by those whose fu is weak -- such as I :-]
Indeed! As the IDs come on a file, one line per ID, I can simply do a search and replace on that file of the nasty chars, and run the file again through my script as is. I could use... I have forgotten the tool. First sort the file, then find duplicate lines, just in case there are any. Ah, 'uniq'. -- Cheers / Saludos, Carlos E. R. (from 15.2 x86_64 at Telcontar)