Sponsored Content
Full Discussion: Tokenizing a String in unix
Top Forums Shell Programming and Scripting Tokenizing a String in unix Post 302367724 by rajeshorpu on Tuesday 3rd of November 2009 09:40:11 AM
Old 11-03-2009
Tokenizing a String in unix

Hi All,

I have String i want to tokenize based on one delimiter.

Original String is -pComments.properties,-iPELF4

i want to tokenize the original string based on ',' (comma) as delimiter and collect them individually like

string1=-pComments.properties
string2=-iPELF4


Please advice or send some sample code.

Thanks-
Raj
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

An Idea for Tokenizing

One of the monitoring tools in Java is called `jps`, and it monitors all Java processes that are run by the user, an example output would be like this: 3459 Jps 2348 test 2311 Util where the first column represents Process IDs and the second column represents Java processes names.... (8 Replies)
Discussion started by: neked
8 Replies

2. UNIX for Dummies Questions & Answers

splitting a string in unix

i need to split a line using a delimiter, and store it into a array :( (2 Replies)
Discussion started by: lmadhuri
2 Replies

3. Shell Programming and Scripting

string tokenizing

I have a string that looks like this: blahblahblah_^substring^_blahblahblah I need to extract substring, the bit between the ^ characters, into another string variable. This will be in a bash shell script. Thanks. (2 Replies)
Discussion started by: daflore
2 Replies

4. Linux

string characters in UNIX

I need some help. when i use the following command, it deletes all lines containing WINNT& v2010 and WINNT& v2010.2 I just want it to delete lines containing WINNT & v2010 only. perl -n -i.bak -e 'print unless /WINNT/&&/v2010/' *.* Danish (2 Replies)
Discussion started by: sdanish110
2 Replies

5. Shell Programming and Scripting

string sorting in unix

Hi I need how to sort string characters for Example i have a file that contains this data example string "fan" but i want to display "afn" contained words "afn" is in sorted format for fan. File data faty gafny gaifny dafan gafnniunt O/p gafny gafnniunt (3 Replies)
Discussion started by: polineni
3 Replies

6. Shell Programming and Scripting

Problem in tokenizing the string

Supposed I have a string in the format: <service_name> = <ldap user FDN> : <password> like DNS = cn=user1,o=company : pwd I want to tokenize like: service name:DNS UserName: cn=user1,o=company Password: pwd. Because of the '=' sign between Service Name and LDAP Name I not... (8 Replies)
Discussion started by: saurabhkoar
8 Replies

7. Shell Programming and Scripting

Extract a string from another string in UNIX

I have a string string="Please have a nice day and sleep well Replace_12123_31233_32134_12342 Good day" How do i replace "Replace_12123_31233_32134_1234" in the above string.?? Please help. Regards, Qwerty (3 Replies)
Discussion started by: qwertyu
3 Replies

8. Shell Programming and Scripting

Sub String in UNIX Script

Hi I have filenames coming as FILE.V<Version>.YYYYMMDD.z FILE.V260.20140423.z FILE.V1.20140523 FILE.V9999.20140324.z How do I extract the version number in a variable I need 260 1 9999 extracted into variable by Unix script (3 Replies)
Discussion started by: sparsh2012
3 Replies

9. Shell Programming and Scripting

String search in UNIX

Hi Team, Please help me with a command which greps the exact match of the string which I am searching in a file. For examplecat > file abc abcd def ghi In the above file I just wanted to display abc which is first entry. When I execute grep command cat file | grep "abc" it results... (3 Replies)
Discussion started by: madhuraju
3 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
SSAStringCpy(3SNMP)					      SNMP Library Functions					       SSAStringCpy(3SNMP)

NAME
SSAStringCpy, SSAStringInit, SSAStringToChar, SSAStringZero - Sun Solstice Enterprise Agent string helper functions SYNOPSIS
cc [ flag ... ] file ... -lssasnmp [ library .. ] #include <impl.h> void *SSAStringZero(String *string); int SSAStringInit(String *string, uchar_t *chars, int len, char *error_label); int SSAStringCpy(String *string1, String *string2, char *error_label); char *SSAStringToChar(String string); DESCRIPTION
The SSAStringCpy() function makes a deep copy of string2 to string1. This function assumes that string1 has been processed by the SSAS- tringZero() function. Memory is allocated inside the string1 and the contents of string2, not just the pointer, is copied to the string1. If an error is encountered, an error message is stored in the error_label buffer. The SSAStringInit() function copies the char array from chars to the string instance with the specified length len. This function assumes that the string instance has been processed by the SSAStringZero() function or no memory is allocated inside the string instance. If an error is encountered, an error message is stored in the error_label buffer. The SSAStringToChar() function returns a temporary char array buffer for printing purposes. The SSAStringZero() function frees the memory inside of the String instance, but not the string object itself. RETURN VALUES
The SSAStringInit() and SSAStringCpy() functions return 0 if successful and -1 if error. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 30 Apr 2006 SSAStringCpy(3SNMP)
All times are GMT -4. The time now is 10:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy