#!/bin/bash function tohuman { y=$(echo $1 | cut -d "/" -f 1) m=$(echo $1 | cut -d "/" -f 2) d=$(echo $1 | cut -d "/" -f 3) if [ $d -lt 50 ]; then echo -n "20$d-$m-$y"; else echo -n "19$d-$m-$y"; fi } cat arf4 | while read l; do read title; read name; read abstract; read report; read date; # echo "Title : $title" # echo "name : $name" # echo "abstract : $abstract" # echo "rapport : $rapport" # echo "date : $date" echo -n "insert into \`stages\` (title,student,txt,report,beg, end) VALUES (\"$title\",\"$name\",\"$abstract\",\"$report\",\"" tohuman $date; echo -n "\",\"" tohuman $date; echo "\");"; done