Replace field into column csv file bash script First command is more faster than second Exemple file 1613667679,TXT,google.com,8.8.8.8,4,0,4,0,N/A,2,N/A 1613667679,TXT,google.com,,8.8.8.8,4,0,4,0,N/A,2,N/A 1613667679,TXT,google.com,,8.8.8.8,4,0,4,0,N/A,2,N/A Replace timestamp to date first column sed -r 's#(([^0-9][0-9]{0,9})*)(\b[0-9]{10}\b)(([0-9]{0,9}[^0-9])*)#printf "%s%s%s" "\1" $(date -d@\3 "+%Y-%m-%d %H:%M:%S") "\4";#ge' /mnt/backup/file.csv > file.csv.t mv file.csv{.t,} Replace timestamp to date first column IFS=, while read -ra a; do # delete double quote a="${a[0]//\"}" newDate=$(date +"%Y-%m-%d %H:%M:%S" -d @$a) a=$(echo "${a[0]}" | sed "s/${a[0]}/$newDate/"); echo "${a[*]}"; done < file.csv.csv > file.csv.t mv file.csv{.t,}