Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get part of value

25 views
Skip to first unread message

moonhkt

unread,
Oct 31, 2017, 12:25:24 PM10/31/17
to


I have shell script want to split into report , the script have sender, to user email or may have bcc or cc list .


data file
1234 5678 -f sender-addr -b jjj -a abc.pdf to-mail1,to-mail2 >/dev/null
1d23 ddf -f sender-addr -a abc.pdf to-mail1,to-mail2 ... .... ..... ....
...xxxx yyy -f sender-addr -a attachment.pdf -b bcc,bcc1 -c cc,cc1 to-email .....


when -f parameter is sender
-b is bcc
-c to cc
-a is attachment

to without option.


How to get to mail list in the middle of line ?

Expect result
to-mail1,to-mail2
to-mail1,to-mail2
to-email

my part of program as below, what is best method get to list ?

n=split($0,arry)
sender=""
attach=""
cc=""
bcc=""
for (i = 1 ; i <= n ; i++) {
if ( arry[i] == "-f" ) {
sender=arry[i + 1 ]
}
else if ( arry[i] == "-a") {
attach=arry[i+1]
}
else if ( arry[i] == "-b" ) {
bcc=arry[i+1]
}
else if ( arryp[i] == "-c") {
cc=arry[i+1]
}

}
print "sender " sender
print "attach " attach
print "cc " cc
print "bcc " bcc
print " "




0 new messages