| Author |
awk pipes question...
|
|
| Mag Gam 2007-04-11, 6:57 pm |
| I am not sure if should use awk pipes in this manner, but here I go
anyway
command | awk '/expression/ {print $1}' gives me a list like this:
object1
object2
object3
I would like to do
command2 object1
command2 object2
command2 object3
Any advice?
TIA
| |
|
| On 11 Apr 2007 08:29:53 -0700,
"Mag Gam" <magawake@gmail.com> wrote:
> I am not sure if should use awk pipes in this manner, but here I go
> anyway
> command | awk '/expression/ {print $1}' gives me a list like this:
> object1 object2 object3
> I would like to do command2 object1 command2 object2 command2 object3
[sorry for the line-wrapping]
Maybe a 'while' loop?
command | gawk '/expression/ {print $1}' |
while read file; do
command2 ${file}
done
--
Seb
| |
| Ed Morton 2007-04-11, 6:57 pm |
| Seb wrote:
> On 11 Apr 2007 08:29:53 -0700,
> "Mag Gam" <magawake@gmail.com> wrote:
>
>
>
>
>
>
>
>
> [sorry for the line-wrapping]
>
> Maybe a 'while' loop?
>
>
> command | gawk '/expression/ {print $1}' |
> while read file; do
> command2 ${file}
> done
>
>
This is a shell question, not an awk one, and there's a better shell
solution that doesn't involve awk at all so I suggest the OP post the
question to comp.unix.shell.
Ed.
| |
|
| On Apr 11, 11:29 am, "Mag Gam" <magaw...@gmail.com> wrote:
> I am not sure if should use awk pipes in this manner, but here I go
> anyway
>
> command | awk '/expression/ {print $1}' gives me a list like this:
> object1
> object2
> object3
>
> I would like to do
> command2 object1
> command2 object2
> command2 object3
>
If I understand what you're asking, you want:
command | awk '...' | xargs command2
| |
|
|
| news.t-online.de 2007-04-15, 6:57 pm |
| Mag Gam wrote:
> I am not sure if should use awk pipes in this manner, but here I go
> anyway
>
> command | awk '/expression/ {print $1}' gives me a list like this:
> object1
> object2
> object3
>
>
> I would like to do
> command2 object1
> command2 object2
> command2 object3
>
>
> Any advice?
>
> TIA
>
command | awk '/expression/ {print "command2 "$1}'
|
|
|
|