LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gawk, comma delim to fixed length? (https://www.linuxquestions.org/questions/programming-9/gawk-comma-delim-to-fixed-length-280223/)

johniccp 01-20-2005 03:07 PM

gawk, comma delim to fixed length?
 
Hi,

Is there a way to program gawk such that a 60 field comma delimited file is converted to a fixed length file? I'd like to set the length of each field.

I tried first editing the file using vi, and changing all commas to tabs, but the variety of data within fields resulted in a "abnormal" (not normalized) file.

If gawk is the wrong utility for the job, I'd like to know that too.

Thank you.

Tinkster 01-20-2005 04:21 PM

gawk should do just fine ... you can parse the fields by
setting the FS appropriately and then output using printf
with padding .... voila.


Cheers,
Tink


All times are GMT -5. The time now is 04:35 AM.