- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: awk script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 07:38 AM
тАО02-08-2006 07:38 AM
awk script
list="apple:fruit
dog:animal"
for i in $list;
do
echo $i |awk -F: '{ vob =$1; vobpath=$2;
"unix-command vob" }'
done
I want to run a unix-command within awk, can it be done?
how do I let the unix command know "vob" is not literal "vob", but a variable?
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 07:45 AM
тАО02-08-2006 07:45 AM
Re: awk script
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 07:48 AM
тАО02-08-2006 07:48 AM
Re: awk script
# echo "$list" | awk -F: '{print $1,$2}' | xargs -n1 unix-command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 07:49 AM
тАО02-08-2006 07:49 AM
Re: awk script
list="apple:fruit
dog:animal"
for i in `echo $list |awk -F: '{ print $1}'`
do
unixcommand $i
done
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 07:57 AM
тАО02-08-2006 07:57 AM
Re: awk script
I'm not sure exactly what you want to run, but you can do things like this:
# echo "hi:there" |awk -F: '{print $1;system("echo ok|xargs")}'
# echo "hi:there" |awk -F: '{print $1;system("date")}'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 08:15 AM
тАО02-08-2006 08:15 AM
Re: awk script
for i in $list;
do
echo $i |awk -F: '{ vob =$1; vobpath=$2;
system("cleartool lsvob vob") }'
done
it interpret vob as "vob" instead of a variable...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 08:21 AM
тАО02-08-2006 08:21 AM
Re: awk script
try this:
for i in $list
do
echo $i |awk -F: '{ vob=$1; vobpath=$2;
system("cleartool lsvob" vob) }'
done
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 08:28 AM
тАО02-08-2006 08:28 AM
Re: awk script
Here's a better example:
# cat ./runner
#!/usr/bin/awk -f
{
system("echo ok " $1)
}
echo "Gemini" | ./runner
Notice that the command to run and its fixed arguments are enclosed in double quotes. The variable data is not.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 09:06 AM
тАО02-08-2006 09:06 AM
Re: awk script
#!/bin/sh
list="apple:fruit
dog:animal"
for i in $list;
do
vob=`echo $i |awk -F: '{print $1}'`
echo $vob
done
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2006 09:41 AM
тАО02-08-2006 09:41 AM
Re: awk script
I got it!
system("cleartool lsvob" vob) }'
I assigned everyone some points!!!!
thank you again!!