|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
hi all
say I have a target file as ----- ----- aaaa = { bbbbbbbbbbbbbbbbbbbb} qqqq ={ dddddddddddd, cccccccccccccc} ------- -------- and i need output as { bbbbbbbbbbbbbbbbbbbb} or { dddddddddddd, cccccccccccccc} depending on aaaa or qqqq so if i use echo $Result |perl -lne "print if / aaaa ={ /../ }" i get result but i need to put it in loop while read SOMETHING; do echo $Result |perl -lne "print if / $SOMETHING={ /../ }" done I am not able to do it. Can any one me... regards kris |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Fri, 07 Sep 2007 18:28:45 -0000, krisworld
<krishnamurthy.iyer@gmail.com> wrote: > > > hi all > > say I have a target file as > ----- > ----- > aaaa = { bbbbbbbbbbbbbbbbbbbb} > qqqq ={ dddddddddddd, > cccccccccccccc} > ------- > -------- > and i need output as > { bbbbbbbbbbbbbbbbbbbb} > or > { dddddddddddd, > cccccccccccccc} depending on aaaa or qqqq > > > so if i use > > echo $Result |perl -lne "print if / aaaa ={ /../ }" > i get result > > but i need to put it in loop > > while read SOMETHING; do > > echo $Result |perl -lne "print if / $SOMETHING={ /../ }" > > done > > I am not able to do it. > Can any one me... > regards > kris > while read SOMETHING; do echo "$SOMETHING" | perl... done < file Do you need the while read loop, or can you do the whole thing with perl? -- New York is real. The rest is done with mirrors. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
hi
i understand what u say, but my issue is how to pass a variable in a Regular Expression i have aaaa qqqq into "SOMETHING" now i shall loop the complete data which is in $Result SOMETHING I shall appreciate if u could me. kris and need to extract only values in between { .. } depending on the value of On Sep 8, 5:05 am, Bill Marcum <marcumb...@bellsouth.net> wrote: > On Fri, 07 Sep 2007 18:28:45 -0000, krisworld > > > > <krishnamurthy.i...@gmail.com> wrote: > > > hi all > > > say I have a target file as > > ----- > > ----- > > aaaa = { bbbbbbbbbbbbbbbbbbbb} > > qqqq ={ dddddddddddd, > > cccccccccccccc} > > ------- > > -------- > > and i need output as > > { bbbbbbbbbbbbbbbbbbbb} > > or > > { dddddddddddd, > > cccccccccccccc} depending on aaaa or qqqq > > > so if i use > > > echo $Result |perl -lne "print if / aaaa ={ /../ }" > > i get result > > > but i need to put it in loop > > > while read SOMETHING; do > > > echo $Result |perl -lne "print if / $SOMETHING={ /../ }" > > > done > > > I am not able to do it. > > Can any one me... > > regards > > kris > > while read SOMETHING; do > echo "$SOMETHING" | perl... > done < file > > Do you need the while read loop, or can you do the whole thing with > perl? > > -- > New York is real. The rest is done with mirrors.- Hide quoted text - > > - Show quoted text - |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
In article <1189189725.076359.21350@19g2000hsx.googlegroups.c om>,
krisworld <krishnamurthy.iyer@gmail.com> wrote: > while read SOMETHING; do > > echo $Result |perl -lne "print if / $SOMETHING={ /../ }" Aren't you missing a / at the end? > > done > > I am not able to do it. > Can any one me... > regards > kris while read SOMETHING; do export SOMETHING echo $Result | perl -lne 'print if / $ENV{SOMETHING}={ / .. / }/' -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
![]() |
| Outils de la discussion | |
|
|