Thanks, Nathan. I can confirm that. Not redirecting standard input to a file but putting path/to/spoolfile as last argumnent works, as indicated in the other message I sent to the list. I checked it on the command line.
On Sun, Apr 14, 2019 at 05:38:31PM -0400, Nathan Stratton Treadway wrote: > On Sun, Apr 14, 2019 at 20:06:04 +0200, felixs wrote: > > 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, > > If you don't enter any file names on the sed command line it reads from > stdin (and thus works with your "< /path/to/spoolfile" redirect). > > However, sed can instead accept a list of files on the command line and > it will then read from each in turn, so instead of having the shell > redirect stdin, just put the wildcard path as the trailing argument on > the command line and let the shell expand the wildcard into the list of > individual files: > sed -ne '/^From: $EMAIL_ADDRESS/p ; /Subject: $SUBJECT/p' > path/to/spoolfile/* > > (The applicable paragraph from the [GNU] sed man page is: > If no -e, --expression, -f, or --file option is given, then the first > non-option argument is taken as the sed script to interpret. All > remaining arguments are names of input files; if no input files are > specified, then the standard input is read. > ) > > Nathan Well, I used the -e option and the first non-option argument is taken as the sed script (on my command line: the regexp), isn't it?. And standard input (redirected to an input path/to/spoolfile/* ) is not read as it (maybe) should. Are there any more list members that can confirm that redirecting it in the way I did, does not work/generates an error message? Cheers, felixs