Skip to content

Instantly share code, notes, and snippets.

@nefigcas
Created March 25, 2025 18:06
Show Gist options
  • Select an option

  • Save nefigcas/888e86a8b9d3856b87599d16bbec426c to your computer and use it in GitHub Desktop.

Select an option

Save nefigcas/888e86a8b9d3856b87599d16bbec426c to your computer and use it in GitHub Desktop.
Odoo data processing
#!/bin/bash
# Usage : MakeBase64CSV.sh infile.csv outfile.csv
# infile.csv columns are : externalID, name, filename or identifier
# infile.csv separator MUST BE |
echo \"External ID\",\"Name\",\"Image\" > $2
while IFS="|" read f1 f2 f3; do
# recopy external ID and name
echo -n $f1,\"$f2\", >> $2
#If third column represents the picture's filename (not the key), please use this command
cat $(echo ${f3} | tr -d '\r' | tr -d '"') | base64 --wrap=0 >> $2
#If third column represents the key to match with the filename, please use this command
# cat $(echo ${f3} | tr -d '\r' | tr -d '"').jpg | base64 --wrap=0 >> $2
#Carrier return at end of line
echo >> $2
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment