03-21-2007
63,
0
Join Date: Nov 2006
Last Activity: 19 April 2012, 11:18 AM EDT
Posts: 63
Thanks Given: 3
Thanked 0 Times in 0 Posts
adding delimiter to a fixed width file
Hi ,
I have a file :
CSCH74000.00
CSCH74000.00
CSCH74100.00
CSCH74000.00
CSCH74100.00
CSCH74000.00
CSCH74000.00
CSCH74100.00
CSCH74100.00
CSCH74100.00
I have to put a delimiter( say comma) in between after 6th character:
CSCH74,000.00
CSCH74,000.00
CSCH74,100.00
CSCH74,000.00
CSCH74,100.00
CSCH74,000.00
CSCH74,000.00
CSCH74,100.00
CSCH74,100.00
CSCH74,100.00
another scenario is I have:
CSCH72007-03-012007-03-04000.00
CSCH72007-03-052007-03-11000.00
CSCH72007-03-122007-03-18100.00
CSCH742007-03-192007-03-25000.00
CSCH742007-03-262007-03-31100.00
CSCH742007-04-012007-04-01000.00
CSCH742007-04-022007-04-08000.00
CSCH742007-04-092007-04-15100.00
CSCH742007-04-162007-04-22100.00
CSCH742007-04-232007-04-29100.00
I have to put delimiters as following:
CSCH74,2007-03-01,2007-03-04,000.00
CSCH74,2007-03-05,2007-03-11,000.00
CSCH74,2007-03-12,2007-03-18,100.00
CSCH74,2007-03-19,2007-03-25,000.00
CSCH74,2007-03-26,2007-03-31,100.00
CSCH74,2007-04-01,2007-04-01,000.00
CSCH74,2007-04-02,2007-04-08,000.00
CSCH74,2007-04-09,2007-04-15,100.00
CSCH74,2007-04-16,2007-04-22,100.00
CSCH74,2007-04-23,2007-04-29,100.00
Can anyone suggest any idea. I think we will have to use awk to print the file in the file in that specific format.
Thanks
SUmeet