- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Getting File Content
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
Forums
Discussions
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
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
11-25-2004 05:05 PM
11-25-2004 05:05 PM
...
...
DIFFLOTID,0001
...
...
I need to get the 0001 placed into a variable.
Maximum points to correct replies!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2004 05:09 PM
11-25-2004 05:09 PM
Re: Getting File Content
If there are only two fields are seperated by comma, then you can use 'while'
oIFS=$IFS
IFS=","
while read first next
do
done < your_file
IFS=$oIFS
In the above, 'next' is your variable. The above won't work if there is are multiple commands in each line.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2004 05:16 PM
11-25-2004 05:16 PM
Re: Getting File Content
VAR=$(grep "DIFFLOTID" $FILE |awk -F \" '{print $1}')
but i get the whole string DIFFLOTID,0001
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2004 05:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2004 05:36 PM
11-25-2004 05:36 PM
Re: Getting File Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2004 05:36 PM
11-25-2004 05:36 PM
Re: Getting File Content
Thanks for your reply. It was a great help to a neophyte like me. I would like to ask now how can i know if the $var contains pure strings of numbers or alphanumerics?
Many thanks!