- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Variable parse
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
Forums
Discussions
Discussions
Discussions
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
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
12-21-2010 07:38 AM
12-21-2010 07:38 AM
I have this incoming for a grep command.
AAA=1
BBB=1
CCC=2
DDD=533
EEE=991
Question: How to exploit the parse to call a function with the value after the '=' operator.
func(1)
func(1)
func(2)
func(553)
func(991)
...
Bests Regards
Den
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2010 07:55 AM
12-21-2010 07:55 AM
Re: Variable parse
Why not something like:
# awk -F= '{system("echo "$2)}' file
...where 'echo' is your function.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2010 08:33 AM
12-21-2010 08:33 AM
Re: Variable parse
It's because my function is in my ksh
function testentry {
echo "in"
echo $1
...
}
awk -FSERVICE= '{system("testentry "$2)}' /su02/automationlogs/009/odb_SrvLoop_RetrieveServiceNames.log
The run has errors like this:
Global TnsNames.ora check
Tue Dec 21 11:30:02 EST 2010
Check is running from stha2a034
__ stha24041 __
stha24041::HCMVNL2 ===== > INFO:: Undeterminated database version.
stha24041::HCMVNL2 ===== > INFO:: Database seems to be unreachable, bypassed.
stha24041::NIKDEV ===== > INFO:: Datebase is not define in /etc/oratab.
< End of check for stha24041
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
sh: testentry: not found.
Bests Regards
Den
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2010 08:51 AM
12-21-2010 08:51 AM
Solution> t's because my function is in my ksh
OK, consider something like this:
# cat ./myparse
!/bin/sh
MYINPUT=$@
function MYFUNC
{
echo "I see $@"
}
for VAR in ${MYINPUT}
do
VAL=$(echo ${VAR} | cut -d"=" -f2)
MYFUNC ${VAL}
done
...
You could do:
# ./myparse a=1 b=2 c=3
# ./myparse $(< inputfile)
# ./myparse $(grep "=" inputfile)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2010 09:56 AM
12-21-2010 09:56 AM