![]() |
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 |
| Help with Fixed width File Parsing | sate911 | UNIX Desktop for Dummies Questions & Answers | 4 | 05-19-2008 11:18 AM |
| Changing particular field in fixed width file | dsravan | Shell Programming and Scripting | 4 | 02-11-2008 06:08 PM |
| Extracting records with unique fields from a fixed width txt file | sitney | Shell Programming and Scripting | 8 | 02-10-2008 03:18 AM |
| Converting a Delimited File to Fixed width file | raghavan.aero | Shell Programming and Scripting | 2 | 06-06-2007 02:44 PM |
| Fixed Width file using AWK | alok.benjwal | UNIX for Dummies Questions & Answers | 2 | 12-05-2005 11:39 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
I got it as well but is there any other generic way
awk '{OFS=","};{print substr($1,1,6),substr($1,7,12)}' FILE > sum1
Thanks Sumeet |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|