Hi mutt users, fiddling with sed in the mutt mailing bash script I am writing I do not find a way to make sed read all files of a directory from standard in? I redirected standard input to a file and try to 'point' sed to all the files of the directory which is the spoolfile (maildir), like so:
sed -ne '/^From: $EMAIL_ADDRESS/p ; /Subject: $SUBJECT/p' \ < /path/to/spoolfile If I specify a message file on the command line it works. If I try to make sed take its input from ALL the files in the directory using the above syntax it does not. I use, for instance, sed -ne '/^From: $EMAIL_ADDRESS/p ; /Subject: $SUBJECT/p' \ < path/to/spoolfile/* # error: ambiguous redirection or < path/to/spoolfile/'1'* #given that all msg files start with '1' or variations of that, it always fails with the above error messages. I searched in the documentation of sed (info sed), the bash-hacker's wiki (1) and read through the Advanced Bash Scripting Guide, but I haven't found the exact use case of redirecting input to all the files of a directory. The referred wiki points out that [QUOTE] FILENAME references a normal, ordinary file from the filesystem (which of course can be a FIFO, too. Simply everything you can reference in the filesystem. [END QUOTE] using only < path/to/spoolfile #results in error message: ... Is a directory. Ok. But isn't there a way to address all the files in the INBOX? I mean, if it were a mbox format, no problem, that's just one file and its content can be fed into sed. I'd be glad to be able to use this to have sed filter the INBOX for mails having arrived from a known sender with a known subject line, after mutt has polled for new mail. I've seen that one may use a variable and redirect standard in to it, but even thinking of pathname variable it always expands to a directory or to a given file, but to all the files of a directory? Any suggestions appreciated. felixs (1) https://wiki.bash-hackers.org/syntax/redirection ----- Forwarded message from felixs <besteck...@gmail.com> ----- Date: Fri, 12 Apr 2019 00:19:52 +0200 From: felixs <besteck...@gmail.com> To: Willem Offermans <wil...@offermans.rompen.nl> Cc: mutt-users@mutt.org Subject: Re: Send to a Listing (...) I thought of working with sed to get the 'alias line' inserted into the addresses_file.txt, and to modify it inserting commas, so that the file may be further processed by mutt. But that's just an idea. I will take up the crontab suggestion. Thanks for all. On Thu, Apr 11, 2019 at 08:13:13PM +0200, Willem Offermans wrote: > Dear Felixs and mutt friends, > > FYI > > I did some searching and I came across the following: (,,,) > > If you experience problem with scripting, I (we) can help you out. > Note the existence of the Advanced Bash Scripting Guide. You can find it all > over on the internet. I use it for more than a decade or so. > It gives you help with scripting. > > If you need crontab to schedule a job to check your mails, look on the > internet once more. There is plenty of documentation. > > Good luck and happy scripting. > > > > On 10 Apr 2019, at 18:31, felixs <besteck...@gmail.com> wrote: > > > > Thanks for your reply. > > > > On Wed, Apr 10, 2019 at 08:50:53AM +0200, Willem Offermans wrote: > >> Dear Felixs and mutt friends, > >> > >> FreeBSD with mutt, that is a strong team :) > > > > (...) ----- End forwarded message -----