Answer : Here's a variation on Jonathan's answer: awk $([[ $(awk --version) = GNU* ]] && echo --non-decimal-data) -F, ' BEGIN {OFS = FS} { $6 = sprintf("%d", "0x" substr($4, 11, 4)) $5 = sprintf("%d", "0x" substr($4, 7, 4)) $4 = substr($4, 1, 6) print }' I included a rather contorted way of adding the --non-decimal-data option if it's needed. Edit Just for the heck of it, here's the pure-Bash equivalent: saveIFS=$IFS IFS=, while read -r -a line do printf '%s,%s,%d,%d\n' "${line[*]:0:3}" "${line[3]:0:6}" "0x${line[3]:6:4}" "0x${line[3]:10:4}" done IFS=$saveIFS The "${line[*]:0:3}" (quoted * ) works similarly to AWK's OFS in that it causes Bash's IFS (here a comma) to be inserted between array elements on output. We can take further advantage of that feature by inserting array elements as follows