1

In the file each columns have fix size.

Is there any library or function available using that we can convert easily to CSV file ?

There are four columns in the file.

1st - 1233212Q1AQYHDVCS1221
2nd - 64342343EDV53234212
3rd - 11123321111124122
4th - 52122211

Sample records :

1233212Q1AQYHDVCS1221 64342343EDV53234212 11123321111124122
52122211

1233212Q1AQYHDVCS1221 64342343EDV53234212 11123321111124122
52122211

1233212Q1AQYHDVCS1221 64342343EDV53234212 11123321111124122
52122211

1233212Q1AQYHDVCS1221 64342343EDV53234212 11123321111124122
52122211

1233212Q1AQYHDVCS1221 64342343EDV53234212 11123321111124122
52122211

I would like to convert straight forward that file to CSV.

1 Answers1

1

If the columns are separated by whitespace, simple sed can do it:

sed 's/[\t ]+/,/g' input.txt > output.txt

Raunak Agarwal
  • 7,117
  • 6
  • 38
  • 62