|
| cool Statistics |
| | coolcommands: | 1313 | | Categories: | 82 | | Total queries: | 524279 | | Members: | 4288 | |
|
|
|
 |
|
|
Search coolcommands.com
 |
Submitted by:
lvo   |
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
|  |  |  |  |
|
|
|
|
 |
|
|
|
Top 5 Submitters
|
|---|
| lvo | 1138 |
| audet | 37 |
| kah00na | 32 |
| Mariom | 24 |
| lebjf000 | 13 |
Top 5 Searches
|
| Category Solaris | 42738 |
| Category AIX | 38092 |
| Category General UNIX | 34295 |
| solaris | 20874 |
| aix | 19395 |
|
|
|
|