- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to read the result of this command into a VARI...
Operating System - HP-UX
1748128
Members
3900
Online
108758
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО02-07-2005 03:40 PM
тАО02-07-2005 03:40 PM
cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'
Here I am reading a CONFIG.ini file and getting the value of a key-value pair.
I am able to get the result, but am not able to store this into a variable.
I tried many ways, but was unsuccessful.
Please help
Thanks
Ram
Here I am reading a CONFIG.ini file and getting the value of a key-value pair.
I am able to get the result, but am not able to store this into a variable.
I tried many ways, but was unsuccessful.
Please help
Thanks
Ram
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2005 04:04 PM
тАО02-07-2005 04:04 PM
Solution
There are multiple ways and it partly depends on your shell.
For sh, one way is:
ANSWER=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'`
or as a simpler example:
ANSWER=`/bin/ls`
Review the EXPORT statement in the shell.
For C shell, one way is:
set answer=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'`
or as a simpler example:
set answer=`/bin/ls`
Review the difference between variables and environment variables.
There's lots more to this, but that will hopefully be a start. You might like Perl better if you're going to do a lot with strings.
HTH,
Mic
For sh, one way is:
ANSWER=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'`
or as a simpler example:
ANSWER=`/bin/ls`
Review the EXPORT statement in the shell.
For C shell, one way is:
set answer=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'`
or as a simpler example:
set answer=`/bin/ls`
Review the difference between variables and environment variables.
There's lots more to this, but that will hopefully be a start. You might like Perl better if you're going to do a lot with strings.
HTH,
Mic
What kind of a name is 'Wolverine'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2005 04:30 PM
тАО02-07-2005 04:30 PM
Re: How to read the result of this command into a VARIABLE
Hi Ram,
You can assign the outcome of the cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}' to a variable.
Let the variable be varout.
varout=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'`
Note: the symbles before cat and the at the end after the single quotes are the acent symbol.
IA
You can assign the outcome of the cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}' to a variable.
Let the variable be varout.
varout=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'`
Note: the symbles before cat and the at the end after the single quotes are the acent symbol.
IA
Never give up, Keep Trying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2005 04:32 PM
тАО02-07-2005 04:32 PM
Re: How to read the result of this command into a VARIABLE
Thanks a lot mic
ANSWER=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'` is working perfectly ..
I wonder how i have missed it.
May be i have given an extra space somwhere.
Thanks a lot for the reply
Ram
ANSWER=`cat config.ini |grep FILE_SIZE|awk -F= '{print("")$2}'` is working perfectly ..
I wonder how i have missed it.
May be i have given an extra space somwhere.
Thanks a lot for the reply
Ram
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP