Re: substituing $1 one time but not the other
- From: Ed Morton <morton@xxxxxxxxxxxxxx>
- Date: Wed, 27 Sep 2006 13:19:26 -0500
Ed Morton wrote:
<snip>
missed those pesky "<>"s. fixed below.
I don't really know what you mean by that question, but everything before it seems to imply that what you to is instead of this:grep "^Message-ID: <${myid}>$" "${myfolder}"/* | awk -F ':' '{print $1}'
grep '^Message-ID: <my id>$' myfolder/* | awk -F ':' '{print $1;}'
be able to do this:
myid="$1"
myfolder="$2"
grep "^Message-ID: ${myid}$" "${myfolder}"/* | awk -F ':' '{print $1;}'
awk -F: -v myid="$myid" '$0 ~ "^Message-ID: <" myid ">$"{print $1}' "${myfolder}"/*
By the way you don't need grep AND awk since awk can cheerfully do pattern matching on it's own:
myid="$1"
myfolder="$2"
awk -F: -v myid="$myid" '$0 ~ "^Message-ID: " myid "$"{print $1}' "${myfolder}"/*
.
Regards,
Ed.
- References:
- substituing $1 one time but not the other
- From: patrice
- Re: substituing $1 one time but not the other
- From: Ed Morton
- substituing $1 one time but not the other
- Prev by Date: Re: simple alias doesn't work
- Next by Date: Re: substituing $1 one time but not the other
- Previous by thread: Re: substituing $1 one time but not the other
- Next by thread: Re: substituing $1 one time but not the other
- Index(es):