Artificial intelligent assistant

Aligning data to be imported in Database I have file that contain 44 columns. The problem is the there's `,` on one field. I would like to divide that data on the particular column and put it on the next column of it. Raw: 122|abc |ds,we |||wrqg 145|dw |ett,335 |||nxd 166|rotl|qqqp,eoepepe|||ge 776|gge |022 |||pp 039|pot |011a |||lot Expected output: 122|abc |ds |we||wrqg 145|dw |ett |335||nxd 166|rotl|qqqp|eoepepe||ge 776|gge |022 |||pp 039|pot |011a|||lot With this output, the data will be imported on the correct field on my Database table. I've tried this code but the data will add a new column. `awk -F '|' 'BEGIN { OFS=FS } { gsub(",", "|", $3); print }' file` Really need your help guys!

$ awk -F '|' 'BEGIN { OFS=FS } { split($3, a, ","); $3 = a[1]; $4 = a[2]; print }' file
122|abc |ds|we ||wrqg
145|dw |ett|335 ||nxd
166|rotl|qqqp|eoepepe||ge
776|gge |022 |||pp
039|pot |011a |||lot


What I'm doing here is that I split the 3rd field on commas. This assigns the split-up bits into the array `a` as separate array elements. I then set the 3rd field to the first bit, and the 4th field to the second bit (`a[1]` and `a[2]` respectively).

This assumes that the 3rd original field only ever contains a single comma (or no comma at all). If it contains more than one comma, you would lose whatever data comes after the second comma.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy fe53724ffe1c0ec06eccc24b6f202c7d