![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add white space to the end of a line with sed | karlanderson | Shell Programming and Scripting | 7 | 03-09-2009 06:20 AM |
| SED with White Space | sandeep_1105 | UNIX for Dummies Questions & Answers | 1 | 03-02-2009 04:48 PM |
| stripping white space... | Zak | Shell Programming and Scripting | 7 | 10-09-2007 08:41 AM |
| trimming white spaces | briskbaby | Shell Programming and Scripting | 9 | 09-23-2006 07:10 PM |
| Sh scripting problem, matching specific white space | Dickalicious | Shell Programming and Scripting | 7 | 05-24-2006 02:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem with Trimming of white space
Dear Members,
Following is the code which i am using: integer i=7 while ((i <= 10 )); do param[i]=`echo $TEST_OUT | cut -d"^" -f$i` a=`echo ${param[7]}` echo `echo $a | sed 's/+/ /g'` (( i = i + 1)); done From the above code TEST_OUT is a variable which has the following value: TEST_OUT='12345++++++TEST COMPANY+++++++++02182009+++++++01232009+++++++FREIGHT PAYMENT+++5.64' as you can see all the values in TEST_OUT are separated by '+' sign. MY aim is to replace the '+' sign with a white space, so i am using the following command: echo `echo $a | sed 's/+/ /g'` If i do this it is replacing '+' with only one white space. The result looks like '12345 TEST COMPANY 02182009 01232009 FREIGHT PAYMENT 5.64' which i don't want. Suppose we have 7 '+' sign then i would like to see 7 white spaces which is not happening. Its only putting one space. How can i avoid this. I am using Korn Shell. Thanks Sandeep |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|