![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add string to middle of a file | Chiefos | UNIX for Dummies Questions & Answers | 15 | 12-31-2008 05:23 PM |
| Stripping the spaces in a string variable | rag84dec | Shell Programming and Scripting | 3 | 03-27-2008 03:16 AM |
| stripping leftmost characters from string | hcclnoodles | Shell Programming and Scripting | 5 | 11-02-2007 03:52 AM |
| Stripping a portion of string from behind!!! | kumarsaravana_s | UNIX for Dummies Questions & Answers | 5 | 03-18-2007 02:21 PM |
| how to insert and delete characters in the middle of file | ivancheung | High Level Programming | 7 | 10-11-2004 03:08 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I am trying to strip out certain characters from a string on both (left & right) sides. For example, line=see@hear|touch, i only want to echo the "hear" part. Well i have tried this approach:
line=see@hear|touch templine=${line#*@} #removed "see@" echo ${templine%%\|*} #removed "|touch" hear ...apparently it worked but i want to do this in only one line. Can anyone suggest a way on how to do this? Another question, what if i added some more characters like this: line=see@hear|touch|smell ...now i wanted to separate each and every one of them dynamically* like this: (*the values for templine2, 3 & 4 may vary) templine1=see templine2=hear templine3=touch templine4=smell ...can anyone also suggest on this one? Many thanks ![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|