- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- is it possible to split the srting...
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
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
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
тАО08-02-2007 11:37 PM
тАО08-02-2007 11:37 PM
is it possible to split the srting...
and also in my shell
read name
can i send the this name sting to some where to in script? how to use this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 11:46 PM
тАО08-02-2007 11:46 PM
Re: is it possible to split the srting...
http://user.it.uu.se/~matkin/documents/shell/
http://www.unix.com/shell-programming-and-scripting/26955-ksh-split-string-into-variables.html
Ps : don't forget to submit points to your threads
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-02-2007 11:53 PM
тАО08-02-2007 11:53 PM
Re: is it possible to split the srting...
I'm not sure that I'm understanding you correctly, but I'll give it a shot.
The 'read' built-in takes input from the command line and stores it into environmental variables. To elaborate on your example:
$ read name
Ramana
$ echo $name
Ramana
In this case, "Ramana" is stored in the variable $name. To recall the value of $name to the command line, simply 'echo' it. Similarly, to use it in a script, simply reference the variable in the appropriate place.
To store values to multiple variables using a single 'read' command, provide multiple variable names as parameters:
$ read name1 name2
Ramana Joe
$ echo name1
Ramana
$ echo name2
Joe
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2007 12:28 AM
тАО08-03-2007 12:28 AM
Re: is it possible to split the srting...
Lets say I had a string that looked like this.
abc:def
variable name is stingbean
var1=$(echo $stringbean | awk -F: '{print $1}')
var2=$(echo $stringbean | awk -F: '{print $2}')
echo $var1
abc
echo $var2
def
You see, we just used awk to split a string.
F: means : is the separator.
Many characters, or even spaces can be used in this method to take data out of the string.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-06-2007 01:54 AM
тАО08-06-2007 01:54 AM
Re: is it possible to split the srting...
for example:
mysub=substr(mystring,startpos,maxlen)
awk '{print substr(1, 1, 9)
in a string with
987654321
the about will pull the value 9