- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- add unix command in with in awk
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
тАО05-27-2003 07:51 PM
тАО05-27-2003 07:51 PM
add unix command in with in awk
Hi I need to run unix command (hostname) in awk and grep some fields
ioscan -kf |grep disk |grep NO_HW |awk '{print
$1,$3,$5}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2003 08:05 PM
тАО05-27-2003 08:05 PM
Re: add unix command in with in awk
ioscan -kfC disk | grep NO_HW
To pass a value to awk, use -v as in:
ioscan -kfC disk | grep NO_HW | awk -v MYHOST=$(hostname) {print MYHOST": "$1,$3,$5}
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2003 10:03 PM
тАО05-27-2003 10:03 PM
Re: add unix command in with in awk
It working ..How do I assign few variables in
awk.I hope -v can assign for one variable.
shoe me how to do it.
need add uname -r and who -q in the same awk
statement.
Regards
ashan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2003 10:08 PM
тАО05-27-2003 10:08 PM
Re: add unix command in with in awk
From the man page for awk:
"Multiple occurrences of the
-v option can be specified on the awk command line".
Regards
Duncan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2003 10:55 PM
тАО05-27-2003 10:55 PM
Re: add unix command in with in awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-28-2003 01:30 AM
тАО05-28-2003 01:30 AM
Re: add unix command in with in awk
if the variables contain spaces, they should be quoted, e.g.:
# echo blahblah| awk -v unr="$(uname -r)" -v whq="$(who -q)" '{print unr "\n" whq}'
regards,
John K.