Linux / UNIX Tech Support Forum
This is a discussion on Shell Script For Splittting String within the Shell scripting forums, part of the Development/Scripting category; Hi guys and gals iam having a string e.g cat,name,item,class,supplier,supplier2 i want to split this string for ',' comma characher ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi guys and gals
iam having a string e.g cat,name,item,class,supplier,supplier2 i want to split this string for ',' comma characher using shell script i want to store the string in array, plz give me shell script to perform above operations.
|
| Sponsored Links | ||
|
|
|
|||
|
Code:
colname=`echo $GIS_OPT_COLOUMNNAME`
colnames=(`echo $colname | tr ',' ' '`)
#echo "the values of array is ${colnames[@]} "
Last edited by nixcraft; 16-06-2009 at 06:42 PM. |
|
||||
|
You can also use cut command.
__________________
Vivek Gite Linux Evangelist |
|
||||
|
As a delimiter?
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| cut , linux , shell scripting , tr command , unix |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| String manipulation | Gideon | Shell scripting | 19 | 31-05-2009 01:50 AM |
| Shell Script for Searching a String | vivekv | Shell scripting | 7 | 10-03-2009 03:18 AM |
| Binary Conversion Of Shell Script (shell script compiler) | chandanperl | Shell scripting | 3 | 29-07-2008 10:22 AM |
| split files by specifying a string (bash shell) | vikas027 | Shell scripting | 4 | 01-11-2007 04:22 PM |
| example for string connect to a command. | ryan | Shell scripting | 2 | 22-02-2005 01:05 PM |