- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: expr stripping off leading zeroes from a strin...
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
тАО02-05-2009 03:43 PM
тАО02-05-2009 03:43 PM
Re: expr stripping off leading zeroes from a string
> Dennis: Why would a shell patch break the correct standard behavior of expr(1), to make it work like Paul wants?
A long shot, granted, but why not ask about the latest cumulative shell patch?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2009 06:01 PM
тАО02-05-2009 06:01 PM
Re: expr stripping off leading zeroes from a string
I suppose that make sense if you hadn't read my reply stating that expr(1) is working as mandated by the POSIX Standard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2009 07:34 PM
тАО02-05-2009 07:34 PM
SolutionInstead, UNIX95 should be defined (appear on the right side of =) just for the process such as ps:
UNIX95= ps -eH
As far as I know, UNIX95 only has to be defined, null as the above example, or assigned any string to change behavior.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2009 10:06 PM
тАО02-05-2009 10:06 PM
Re: expr stripping off leading zeroes from a string
Unfortunately that's not good enough. :-(
Only these are documented, not expr(1).
for i in /usr/share/man/man1.Z/*; do
zcat $i | fgrep -q UNIX95
if [ $? -eq 0 ]; then echo $(basename $i); fi
done
awk.1 cp.1 edit.1 ex.1 find.1 patch.1 pr.1 ps.1 vedit.1 vi.1 view.1
11.31:
admin.1 alias.1 asa.1 awk.1 bg.1 cal.1 cp.1 cu.1
date.1 edit.1 ex.1 fc.1 fg.1 jobs.1 make.1 nl.1
od.1 patch.1 ps.1 pwd.1 rsh.1 sed.1 sh-posix.1
sort.1 unalias.1 vedit.1 vi.1 view.1 wc.1 who.1 xd.1
- Tags:
- UNIX95
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2009 05:05 AM
тАО02-06-2009 05:05 AM
Re: expr stripping off leading zeroes from a string
> Dennis: I suppose that [would] make sense if you hadn't read my reply stating that expr(1) is working as mandated by the POSIX Standard.
Yes, for the record, I didn't see that in the ~ 4-minutes between my suggestion to fetch the cumulative sh-posix patch and your indication that "The POSIX standard says using substr on numbers is unpredictable".
That's good to know and it suggests that one has to look at the POSIX standards to be aware of this.
Paul's example is with a string, albeit that the string consists of digits. Does the standard distinguish between "strings", "integers" and "strings of numbers"?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2009 05:30 AM
тАО02-06-2009 05:30 AM
Re: expr stripping off leading zeroes from a string
Just a side note that I'm getting better information (and faster) from this forum than I'm getting from the HP software support that we're paying for.
Thanks guys!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2009 06:46 PM
тАО02-06-2009 06:46 PM
Re: expr stripping off leading zeroes from a string
Very indirectly that pays for me. :-)
>JRF: Does the standard distinguish between "strings", "integers" and "strings of numbers"?
The latter doesn't exist:
A string argument is an argument that cannot be identified as an integer argument
The source checks if numeric and strips leading zeros.
The "APPLICATION USAGE" gives you a hint how to solve the problem:
expr substr X"$x" 2 2
- « Previous
-
- 1
- 2
- Next »