replace comma with next line character at even position
Moderators: chulett, rschirm, roy
replace comma with next line character at even position
Hi All,
i need to replace every even position comma (2, 4, 6...n) in the input row into a next line character.
Thanks in advance
i need to replace every even position comma (2, 4, 6...n) in the input row into a next line character.
Thanks in advance
I think this is a good case for a partial server job solution. Read the input as a single column and call up a BASIC routine like this:
Code: Select all
EQUATE Comma TO ','
EQUATE LF TO CHAR(10)
Ans = InString ;** assing the input value to the output string
CommaCount = DCOUNT(Ans,Comma)
IF MOD(CommaCount,2) <> 0 AND CommaCount THEN CommaCount -= 1
FOR x = CommaCount TO 2 STEP -2
Ans[Index(Ans,Comma,x),1] = LF
NEXT x
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can use translator from unix as well
Code: Select all
tr ',' '\n' < filename
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yeah, I didn't noticed this.ray.wurlod wrote:How to do every second comma using tr command?
You can use
Code: Select all
tr ',' '\n' < filename | paste -d',' - -
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Kumar - I am staying out of this one. The poster has gotten several viable options presented to him/her so far.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You have several solutions now. Pick your choice. Get as far as you can and if you have any problems, come back with what you have done and whats not working.madhukar wrote:But i have to do it in datatsage and ....
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.