Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.85 KB | None | 0 0
  1. #cut --complement -d, -f1,2 < EURUSD0.csv | sed -e 's/"//' -e 's/"//' -e 's/:00.000//' > EURUSD.10
  2.  
  3.  
  4. function formatDataTime {
  5.     while read; do
  6.         echo "${REPLY:7:4}"-"${REPLY:1:5}" "${REPLY:12:5}"
  7.     done
  8.  
  9. }
  10.  
  11. function c2p {
  12.     PP=${SROD%%\,*}
  13.     ZP=${SROD#\,}
  14.  
  15.     echo -n $PP,$ZP
  16.  
  17. }
  18.  
  19. function splitReply {
  20.  
  21.     while : ;do
  22.    
  23.         POCZ=${REPLY%%\"*}
  24.         REPLY=${REPLY#\"*}
  25.  
  26.         SROD=${REPLY%%\"*}
  27.         REPLY=${REPLY#*\"}
  28.         if [[ $POCZ == $SROD ]]; then
  29.             echo $REPLY
  30.             break
  31.         fi
  32.         echo -n $POCZ
  33.         c2p    
  34.  
  35.        
  36.     done
  37. }
  38.  
  39.  
  40. function formatFloat {
  41.     while read; do
  42.         REPLY=${REPLY:26}
  43.         splitReply
  44.         #echo "$REPLY"
  45.     done
  46. }
  47.  
  48.  
  49. cut -d , -f3- < EURUSD0.csv > EURUSD1.csv
  50. formatDataTime < EURUSD1.csv > EURUSD2.csv
  51. formatFloat <EURUSD1.csv > EURUSD3.csv
  52.  
  53. paste '-d ' EURUSD2.csv EURUSD3.csv | sed 's/,/ /g' > EURUSD4.csv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement