[Top] [All Lists]

Re: Input of an extracted field value to a script

2001-08-17 11:43:52
* Harsha Vardhana R <hvardhan(_at_)cisco(_dot_)com> [010817 11:05]:

I need to extract a word from 'Subject' field and and pass it on to a script
for further processing.
I am extracting the first word in the 'Subject' field.

My $HOME/.procmailrc contents are


STRING=`formail -zxSubject:` #(get the subject field)
S1=`echo $STRING | cut -f1 -d ' '` #(Extract the first word)

* ^From.*hvardhan
* ^Subject:.Status
| $HOME/ProcTrial/ProcessString "$S1"

But it is not working in the intended way

My procmail log file contents are

procmail: [10233] Fri Aug 17 10:11:24 2001
procmail: Executing "formail,-zxSubject:"
procmail: [10233] Fri Aug 17 10:11:28 2001
procmail: Assigning "STRING=StatusReport  Important  20Aug2001"
procmail: [10233] Fri Aug 17 10:11:29 2001
procmail: Executing "echo $STRING | cut -f1 -d ' '"
procmail: [10233] Fri Aug 17 10:11:29 2001
procmail: Assigning "S1=StatusReport"
procmail: [10233] Fri Aug 17 10:11:40 2001
procmail: Match on "^From.*hvardhan"
procmail: Match on "^Subject:.Status"
procmail: Couldn't determine implicit lockfile from
procmail: Locking ".lock"
procmail: [10233] Fri Aug 17 10:11:43 2001
procmail: Executing "/users/hvardhan/ProcTrial/ProcessString,StatusReport"
procmail: [10233] Fri Aug 17 10:11:48 2001
procmail: Error while writing to "/users/hvardhan/ProcTrial/ProcessString"
procmail: Assigning "LASTFOLDER=/users/hvardhan/ProcTrial/ProcessString
procmail: Unlocking ".lock"

What are the causes for the error here? Are there any special rules
regarding running scripts ?

Looks like something is going wrong w/ your script "ProcessString".
Check the permissions on it.  Is it executable?  I usually invoke
scripts like this:


You could make the script more compact (and perhaps more efficient) by
writing it like this:

* ^From.*hvardhan
* ^Subject:.Status
    S1=`formail -zxSubject: | cut -f1 -d ' '` 
    | $HOME/ProcTrial/ProcessString "$S1"

Won't fix the script error though.

- Matt Dunford <> zoot(_at_)zotikos(_dot_)com ..
-. -- o,;-
Today's `fortune`:
A limerick packs laughs anatomical
Into space that is quite economical.
        But the good ones I've seen
        So seldom are clean,
And the clean ones so seldom are comical.
procmail mailing list

<Prev in Thread] Current Thread [Next in Thread>