|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
"James" <hslee911@yahoo.com> wrote in message news:1156530103.897045.307360@i42g2000cwa.googlegr oups.com... > How does awk match a pattern composed of variables and strings? > For example, > > VAR=hello > awk '/VAR world/' VAR=$VAR > does not work. awk '/'"$VAR"' world/' See http://www.faqs.org/faqs/unix-faq/fa...ection-12.html . Regards Dimitre |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
On 25 Aug 2006 11:21:44 -0700, James
<hslee911@yahoo.com> wrote: > How does awk match a pattern composed of variables and strings? > For example, > > VAR=hello > awk '/VAR world/' VAR=$VAR > does not work. > awk '$0~VAR " world"' VAR=$VAR -- TAPPING? You POLITICIANS! Don't you realize that the END of the "Wash Cycle" is a TREASURED MOMENT for most people?! |
|
|
|
#4 (permalink) |
|
Messages: n/a
Hébergeur: |
Radoulov, Dimitre wrote:
> "James" <hslee911@yahoo.com> wrote in message > news:1156530103.897045.307360@i42g2000cwa.googlegr oups.com... > >>How does awk match a pattern composed of variables and strings? >>For example, >> >>VAR=hello >>awk '/VAR world/' VAR=$VAR >>does not work. > > > awk '/'"$VAR"' world/' > > See http://www.faqs.org/faqs/unix-faq/fa...ection-12.html . > Don't do that. Do this: awk -v var="$VAR" '$0 ~ var " world"' See http://home.comcast.net/~j.p.h/cus-faq-2.html#24. Ed. |
|
![]() |
| Outils de la discussion | |
|
|