![]() |
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 |
| converting date format | mohan705 | Shell Programming and Scripting | 7 | 05-22-2008 11:10 AM |
| converting config file to csv format | zer0dvide | Shell Programming and Scripting | 7 | 03-21-2008 10:33 AM |
| converting PDF to text, rtf doc format | saurya_s | UNIX for Advanced & Expert Users | 1 | 04-23-2004 03:25 PM |
| Error when converting to Postscript format | zing | UNIX for Dummies Questions & Answers | 1 | 06-19-2003 05:07 PM |
| Converting BMP to BM (or other unix format) | EJ =) | UNIX Desktop for Dummies Questions & Answers | 1 | 06-12-2002 08:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
converting text to csv format
I am trying to check each line and based on first two digits, the comma needs to be place. I checked in the earlier post where the text is converted to csv with a tab delimited.
Here is the test file that needs to be changed to csv 11 051701 22 051701 330123405170105170112345 0100001123456789012987654321 0100002123456789012987654321 0100003123456789012987654321 0100004123456789012987654321 0100017123456789012987654321 ....... if the first 2 digits are 11, then a comma is placed after 2nd column and just before the 051701. If the first two digits are 01 then the commas should be place after 01, another comma after 00001, another after 123456789012. In short the output should look like this 11, ,051701 22, ,051701 33,01234,051701,051701,12345 01,00001,123456789012,987654321 01,00002,123456789012,987654321 01,00003,123456789012,987654321 01,00004,123456789012,987654321 01,00017,123456789012,987654321 ....... Any help is appreciated. Thanks ~ |
|
||||
|
converting text to csv format
I was able to get the csv file without any problem. I have one quick question. Is it possible to take the 2nd column on line 3, '01234' and have it on each and every line where you see '01' as the first two characters, like for example
11, ,051701 22, ,051701 33,01234,051701,051701,12345 01,00001,123456789012,987654321 01,00002,123456789012,987654321 01,00003,123456789012,987654321 01,00004,123456789012,987654321 01,00017,123456789012,987654321 ....... to 11, ,051701 22, ,051701 33,01234,051701,051701,12345 01234,01,00001,123456789012,987654321 01234,01,00002,123456789012,987654321 01234,01,00003,123456789012,987654321 01234,01,00004,123456789012,987654321 01234,01,00017,123456789012,987654321 ....... |
|
||||
|
Thanks for your reply. Actually the suggestion you gave is replacing the value from '01' to '01234' and eliminating the other rows. Is there any way to keep the other rows as is and concatenate the '01234' from '33' line to '01' lines. This should be included in the code that was suggested earlier by vgersh99 in gt.awk
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|