Schupp

conv.sh

Jun 18th, 2021
940
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #for file in Kammer*.csv
  2. #do
  3. filename=$(basename -- "$1")
  4. echo ${filename}
  5. extension="${filename##*.}"
  6. filename="${filename%.*}"    
  7. A=$(echo $filename | cut -f2 -d'_')
  8. B=$(echo $filename | cut -f3 -d'_')
  9. G="${A},${B},"
  10.  
  11. while read line
  12.     do  
  13. U=$(echo $line | sed -E 's,([0-9]{2})\.([0-9]{2})\.([0-9]{4}),\3-\2-\1,g')
  14. X=$(echo $U | sed -E 's,([0-9]{4})/([0-9]{2})/([0-9]{2}),\1-\2-\3,g')
  15. Y=$(echo $X | sed -E 's,([0-9]{2})/([0-9]{2})/([0-9]{4}),\3-\2-\1,g')
  16. Z=$(echo $Y | cut -d',' -f1-2,9,13-15,20,23-27)
  17. #R=$(echo $Z | cut -f1 -d ',')
  18. #U=$(echo $R | cut -f3 -d','| awk '{print $4}'| cut -d ':' -f2)
  19.  
  20.  
  21. ##Y=$(echo $X | cut -f2 -d'_')
  22. echo  "${G}${Z}" >> $G.csvdata
  23. OLDC=${C}
  24. OLDD=${D}        
  25.  
  26.     done < "$1"
  27. #done
  28. #mv /tmp/courbestest.csv /home/phil/Schreibtisch/courbestest.csv
  29.  
  30.  
RAW Paste Data