- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- get the last digit(s) from a line or file
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
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
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
07-28-2011 01:48 AM
07-28-2011 01:48 AM
hello,
i tried several tests to get the last digit(s) from a line or file.
my prefered command is "sed"
but in "sed" '*' doesn't mean zero or more occurence like in "grep" , so i use "{0,\}"
example:
RETURN 1
RETURN 11
RETURN 1234
my tests :
echo "RETURN 1" | sed -n '$s/.* \([0-9]\{0,\}\)$/\1/p'
echo "RETURN 11" | sed -n '$s/.* \([0-9]\{0,\}\)$/\1/p'
regards
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 02:22 AM
07-28-2011 02:22 AM
Re: get the last digit(s) from a line or file
>but in "sed" '*' doesn't mean zero or more occurrence like in "grep" , so I use "{0,\}"
"*" works fine for me.
$ echo "RETURN 1234" | sed -n '$s/.* \([0-9]*\)$/\1/p' 1234
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 03:44 AM
07-28-2011 03:44 AM
Re: get the last digit(s) from a line or file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 03:56 AM
07-28-2011 03:56 AM
Re: get the last digit(s) from a line or file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 04:09 AM - edited 07-29-2011 06:33 PM
07-28-2011 04:09 AM - edited 07-29-2011 06:33 PM
Re: get the last digit(s) from a line or file
>Let's see if the attachment scheme still works.
Yes but it is very hard to get to your attachment.
And you might be able to delete your empty post if you hadn't replied to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 04:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 06:15 AM
07-28-2011 06:15 AM
Re: get the last digit(s) from a line or file
hello,
thx for your perfect answers.
i have a solution
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 06:19 AM
07-28-2011 06:19 AM
Re: get the last digit(s) from a line or file
How about a kudo to go with that solution flag?
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 06:59 AM
07-28-2011 06:59 AM
Re: get the last digit(s) from a line or file
@Pete Randall wrote:How about a kudo to go with that solution flag?
As Pete has pointed out, marking a solution does *not* creat a kudos. That's another counter-intuitive new feature of this new-fangled community we share.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2011 08:37 AM
07-28-2011 08:37 AM