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
тАО09-26-2005 06:13 PM
тАО09-26-2005 06:13 PM
AWK
awk NR==1 { print substr($0,33,3); } ${MQUTIL}/abc.snf
for above output value will go to some variable
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:19 PM
тАО09-26-2005 06:19 PM
Re: AWK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:21 PM
тАО09-26-2005 06:21 PM
Re: AWK
# echo "hi" | awk -v var=bye '{ print $0" "var }'
hi bye
# Another way as after awk using variable
# echo "hi" | awk '{ print $0" "var }' var=bye
hi bye
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:21 PM
тАО09-26-2005 06:21 PM
Re: AWK
you can use BEGIN block or use awk option:
awk --assign var=val
eg:
$ echo | gawk -v var=200 'BEGIN { var = var + 100 }; END { print var }'
300
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:21 PM
тАО09-26-2005 06:21 PM
Re: AWK
Var = 'awk NR==1 { print substr($0,33,3); } ${MQUTIL}/abc.snf'
echo $VAR
output is not coming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:22 PM
тАО09-26-2005 06:22 PM
Re: AWK
-v var=value Cause var=value assignment to occur before the BEGIN action (if it exists) is executed.
Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:23 PM
тАО09-26-2005 06:23 PM
Re: AWK
I want to store output of awk in some variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:25 PM
тАО09-26-2005 06:25 PM
Re: AWK
Its case sensitive.
var=`awk NR==1 { print substr($0,33,3); } ${MQUTIL}/abc.snf`
echo $var
- Tags:
- command substitution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:25 PM
тАО09-26-2005 06:25 PM
Re: AWK
# Return String or Content
retstr=$(awk NR==1 { print substr($0,33,3); } ${MQUTIL}/abc.snf)
# Return Value of execution
awk NR==1 { print substr($0,33,3); } ${MQUTIL}/abc.snf
ret=$?
echo "Return value is ${ret}"
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-26-2005 06:26 PM
тАО09-26-2005 06:26 PM
Re: AWK
echo $Var
-Arun