Sponsored Content
Full Discussion: split string using separetor
Top Forums Shell Programming and Scripting split string using separetor Post 302120389 by anbu23 on Wednesday 6th of June 2007 08:02:06 AM
Old 06-06-2007
Code:
string="abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com"
str1=${string%%;*}
str3=${string##*;}
temp=${string#$str1;}
str2=${temp#;$str3}

These 2 Users Gave Thanks to anbu23 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split a string

Hi I have a script that loops though lines of a file and reads each line in to a variable ($LINE). I want to look at the line and split it into it's constituent parts. e.g. a line might be "This is a string" I want to then have variables set to each element thus: A=This B=is C=a... (3 Replies)
Discussion started by: gazingdown
3 Replies

2. Shell Programming and Scripting

split string help

could anyone help in running split cmd split("String1,outputArray,"delimiter); with sample script?. for eg i have abc-def-ghi-sdf- my ultimate aim of asking this is i have a string containing hypens, i want to get the string before last n(2) Hypens (4 Replies)
Discussion started by: senthilk615
4 Replies

3. Shell Programming and Scripting

Split A String

Hi, I am new to scripting and need help splitting a string using space as the delimiter. How can I do that? I want the result to be stored in an Array. I tried using set -A arr $(echo $FILE) echo $arr The result of the above was ''. Thanks. (2 Replies)
Discussion started by: newbie187
2 Replies

4. Shell Programming and Scripting

split the string

I need to split the string msu1_2 It should be generic for any string of the form msu<digits>_<digits> so that i get $X =1 and $Y = 2 Please help Thanks (5 Replies)
Discussion started by: asth
5 Replies

5. Shell Programming and Scripting

Split string

Hi, can we split a number like this.. if i have something like 85743975945738, can it be converted as 8574-3975-945738 in ksh shell using single command... Thanks! (5 Replies)
Discussion started by: nram_krishna@ya
5 Replies

6. Shell Programming and Scripting

split string

Hi I am facing a problem in spitting a string. Here is the string -------------------- subject1=10;subject2=30;subject3=40;subjectcode=10001;... Now, I want only marks not the subject code. (there can be 'n' subjects) ie. 10 30 40 My doubt ---------- How do I... (5 Replies)
Discussion started by: jionnet
5 Replies

7. Shell Programming and Scripting

split string

I am trying to get some data from a file and print it on the same line. I have a script that gets the body of emails and display it, but i want it to display each emails body in one line no matter how big it is. eg insted of this email1: bla bla bla bla bla bla bal email2: bla bla bla... (7 Replies)
Discussion started by: maddog21
7 Replies

8. Shell Programming and Scripting

Need to split a string

Hi, We have a SunOS 5.10 Generic_142900-13 sun4v sparc SUNW,T5240. I'm trying to find a way to split a string into 2 variables. Ex: parm1="192.168.1.101/parent/child" What I need to do is split the string above into: host="192.168.1.101" location="parent/child" I saw the... (3 Replies)
Discussion started by: adshocker
3 Replies

9. Shell Programming and Scripting

Split the string in perl

Hi All, How to split the string KAR_Celltick_Ban_GSMGW3 and want to pickup the third filed. Sometime the string may be "KAR_Celltick_Ban" like this Thanks in advance (1 Reply)
Discussion started by: sujit_kashyap
1 Replies

10. UNIX for Beginners Questions & Answers

How to split a string into array?

value=malayalam # i need to store the value in an array by splitting the character #the output i need is m a l a y a l a m Please use CODE tags for output data as well as required by forum rules! (5 Replies)
Discussion started by: Meeran Rizvi
5 Replies
Unicode::Escape(3pm)					User Contributed Perl Documentation				      Unicode::Escape(3pm)

NAME
Unicode::Escape - Escape and unescape Unicode characters other than ASCII VERSION
This document describes Unicode::Escape version 0.0.1 SYNOPSIS
# Escape Unicode charactors like '\u3042\u3043\u3044'. # JSON thinks No more Garble!! # case 1 use Unicode::Escape; my $escaped1 = Unicode::Escape::escape($str1, 'euc-jp'); # $str1 contains charactor that is not ASCII. $str1 is encoded by euc-jp. my $escaped2 = Unicode::Escape::escape($str2); # default is utf8 # $str2 contains charactor that is not ASCII. my $unescaped1 = Unicode::Escape::unescape($str3, 'shiftjis'); # $str3 contains escaped Unicode character. return value is encoded by shiftjis. my $unescaped2 = Unicode::Escape::unescape($str4); # default is utf8 # $str4 contains escaped Unicode character. # case 2 use Unicode::Escape qw(escape unescape); my $escaped1 = escape($str1, 'euc-jp'); # $str1 contains charactor that is not ASCII. $str1 is encoded by euc-jp. my $escaped2 = escape($str2); # default is utf8 # $str2 contains charactor that is not ASCII. my $unescaped1 = unescape($str3, 'shiftjis'); # $str3 contains escaped Unicode character. return value is encoded by shiftjis. my $unescaped2 = unescape($str4); # default is utf8 # $str4 contains escaped Unicode character. # case 3 use Unicode::Escape; my $escaper = Unicode::Escape->new($str, 'shiftjis'); # $str contains charactor that is not ASCII. $str is encoded by shiftjis.(default is utf8) my $escaped = $escaper->escape; # case 4 use Unicode::Escape; my $escaper = Unicode::Escape->new($str); # $str contains escaped Unicode character. my $unescaped1 = $escaper->unescape('shiftjis'); my $unescaped2 = $escaper->unescape; # default is utf8. DESCRIPTION
Escape and unescape Unicode characters other than ASCII. When the server response is javascript code, it is convenient. METHODS
new( $string[, $encode ] ) string Target string for escape or unescape. encode For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) escape( $string[, $encode ] ) string Target string. This argument is unnecessary when called as object method. encode For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) This argument is unnecessary when called as object method. unescape( $string[, $encode ] ) string Target string. This argument is unnecessary when called as object method. encode For instance, 'utf8', 'shiftjis', and 'euc-jp', etc. (See Encode) SEE ALSO
Unicode::String, Encode INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. Please report any bugs or feature requests to "bug-unicode-escape@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. AUTHOR
Hitoshi Amano "<seijro@gmail.com>" LICENCE AND COPYRIGHT
Copyright (c) 2006, Hitoshi Amano "<seijro@gmail.com>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.12.3 2011-06-05 Unicode::Escape(3pm)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy