coolcommands.com - the search engine for unix sysadmins :: unix commands and scripts
Thursday September 9, 2010


 Home
 Search
 Advanced Search
 Category Search
 Affiliates
 Acknowledgements
 Cool Links

Username

Password

Remember me
Forgot your password?
Create an account

Who's Online
We have 40 guests online

Newest Member

santoshd

Hit Counter
4775994 Visitors

cool Statistics
coolcommands:1313
Categories:82
Total queries:524279
Members:4288





Search coolcommands.com
Search Keyword:


coolcommand

how to include a function in awk to return a system command
Description

Here is an example of how to include a function in awk to return a system command:

#!/bin/sh

awk '{
Date=getenv("date");
Hostname=getenv("uname -n");
printf("This script ran on %s at %s\n",Hostname,Date);
}
function getenv ( cmd ) { cmd | getline tmp_var; close(cmd); return tmp_var }' infile
Example

function getenv ( cmd ) { cmd | getline tmp_var; close(cmd); return tmp_var }

Return to search results

Random coolcommands

coolcommand: how to find the names or addresses of your DNS servers
Example: /etc/resolv.conf
[show me the details]
coolcommand: pmap - how to find address space map a process occupies in Sun Solaris
Example: /usr/proc/bin/pmap pid
[show me the details]
coolcommand: iostat - get hardware configuration in Sun Solaris
Example: iostat -En
[show me the details]
coolcommand: vxrecover - how to bring a volume back online in background mode in Veritas Volume Manager
Example: vxrecover -b vg01
[show me the details]

coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts



FREE
myPMS

Password
Management
System

by

LVOware.com




Top 5 Submitters

lvo1138
audet37
kah00na32
Mariom24
lebjf00013

Top 5 Searches

Category Solaris42738
Category AIX38092
Category General UNIX34295
solaris20874
aix19395

Terms of Use
Privacy
Contact


 
coolcommands.com © 2010. All Right Reserved.
Programming by PRATTICO Consulting . Hosting by Apricusum