HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- extract last name from symbol
Operating System - OpenVMS
1829581
Members
3989
Online
109992
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
Forums
Discussions
Discussions
Discussions
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
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
08-28-2007 11:57 PM
08-28-2007 11:57 PM
extract last name from symbol
Hi,
I have a script which requires the input of a users full name as part of account creation process. I now need to modify the script and extract only the last name. This is a bit tricky now as there may be anything up to 6 or so names in the full name depending on the country of origin.
Anyone have any thoughts how I would extract the last name from a symol containing something like DANIEL AUGUSTO GASPAROTTO DOS SANTOS?
Any thoughts would be most welcome?
Thanks,
Daren
I have a script which requires the input of a users full name as part of account creation process. I now need to modify the script and extract only the last name. This is a bit tricky now as there may be anything up to 6 or so names in the full name depending on the country of origin.
Anyone have any thoughts how I would extract the last name from a symol containing something like DANIEL AUGUSTO GASPAROTTO DOS SANTOS?
Any thoughts would be most welcome?
Thanks,
Daren
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 12:05 AM
08-29-2007 12:05 AM
Re: extract last name from symbol
Daren,
Have a look at the lexical function F$ELEMENT (examples).
Seems like a small loop in DCL will do the trick.
Regards,
Kris (aka Qkcl)
Have a look at the lexical function F$ELEMENT (examples).
Seems like a small loop in DCL will do the trick.
Regards,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 12:16 AM
08-29-2007 12:16 AM
Re: extract last name from symbol
If it's your script, the "easier" thing to do would be to modify it to prompt for the individual pieces of the name, First, as many middle names, and then Last name. Other than that if you can be "guaranteed" that there will always be spaces, you can find the last piece using f$element, but what's to say a last name is one "word" ... perhaps Dos Santos is the real family name.
Seperate prompts would make the most sense to me.
Cheers,
Art
Seperate prompts would make the most sense to me.
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 12:44 AM
08-29-2007 12:44 AM
Re: extract last name from symbol
How does the data get into the symbol.
It seems to be kroken already, as it is uppercase only.
Can you influence the data provider to do the right thing and present the lastname as a seperate variable?
In the example posted. What would you want the last name to be? "Santos" or "Dos Santos"? That may be obvious to you, not to me. And I'm serious... what is the actual last name in the example?
My last name is "van den Heuvel", not "HEUVEL".
How can any script automatically determine that?
Are you willing to build in a lot of local-language rules?
Now if you question is not about language and nameing, but just about DCL and grabbing the last word in a piece of string the I would feed it into F$EDIT TRIM+COMPRESS first. Then loop through F$ELEM untill one too far, or look backwards with F$EXTR(end,1,name) untill a space found, then extract forwards.
In PERL:
$ x="DANIEL AUGUSTO GASPAROTTO DOS SANTOS"
$ perl -e "$_ = shift; print $1 if /(\S+)\s*$/" "''x
SANTOS
$_ = shift; # load default variabe $_ from first command argument
print $1 if # print first component remembered in matching expression.
/(\S+)\s*$/ # regular expression.
(\S+) = remember a(any) piece of non-whitepace string
\s* = followed by zero or more spaces
$ = at end or variable.
"''x ! Makes sure data comes in p1 only.
hth,
Hein.
It seems to be kroken already, as it is uppercase only.
Can you influence the data provider to do the right thing and present the lastname as a seperate variable?
In the example posted. What would you want the last name to be? "Santos" or "Dos Santos"? That may be obvious to you, not to me. And I'm serious... what is the actual last name in the example?
My last name is "van den Heuvel", not "HEUVEL".
How can any script automatically determine that?
Are you willing to build in a lot of local-language rules?
Now if you question is not about language and nameing, but just about DCL and grabbing the last word in a piece of string the I would feed it into F$EDIT TRIM+COMPRESS first. Then loop through F$ELEM untill one too far, or look backwards with F$EXTR(end,1,name) untill a space found, then extract forwards.
In PERL:
$ x="DANIEL AUGUSTO GASPAROTTO DOS SANTOS"
$ perl -e "$_ = shift; print $1 if /(\S+)\s*$/" "''x
SANTOS
$_ = shift; # load default variabe $_ from first command argument
print $1 if # print first component remembered in matching expression.
/(\S+)\s*$/ # regular expression.
(\S+) = remember a(any) piece of non-whitepace string
\s* = followed by zero or more spaces
$ = at end or variable.
"''x ! Makes sure data comes in p1 only.
hth,
Hein.
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP