Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. /documents/accounts/transfer/done/abc_yyyy-mm-dd_hh-mm-ss-[0-9]{6}.csv
  2. /documents/namelist/transfer/done/def_yyyy-mm-dd_hh-mm-ss-[0-9]{6}.csv
  3. /documents/newcustomer/transfer/done/ghijkl_yyyy-mm-dd_hh-mm-ss-[0-9]{6}.csv
  4.  
  5. #!/bin/bash
  6. date=`date +%Y-%m-%d`;
  7. config_file="/scripts/config/abc.cfg";
  8. echo $config_file;
  9. URL="http://localhost:9200/document-$date";
  10. find /documents -type f -name "*_'${date}'*.csv" | while read filename
  11. do
  12. echo "filename : ${filename}"
  13. var=$(base64 $filename| perl -pe 's/n//g');
  14. var1= curl -XPUT 'http://localhost:9200/documents-'$date'/document/?pipeline=attachment&pretty' -d' { "data" : "'$var'" }')
  15. done;
  16.  
  17. find -type f -name "*_${date}*.csv"
  18.  
  19. touch abc_2016-12-28-3523424-acsfsc.csv
  20. touch abc_2016-12-29-3523424-acsfsc.csv
  21.  
  22. find . -maxdepth 1 -type f -print
  23. ./abc_2016-12-28-3523424-acsfsc.csv
  24. ./abc_2016-12-29-3523424-acsfsc.csv
  25.  
  26. date=$(date +%Y-%m-%d)
  27. find -type f -name "*_${date}*.csv"
  28. ./abc_2016-12-28-3523424-acsfsc.csv
  29.  
  30. while IFS='' read -r -d '' filename
  31. do
  32. echo "filename : ${filename}"
  33. var=$(base64 "$filename"| perl -pe 's/n//g');
  34. var1=$(curl -XPUT "http://localhost:9200/documents-$date/document/?pipeline=attachment&pretty" -d '{ "data" : "'"$var"'" }')
  35. done < <(find -type f -name "*_${date}*.csv" -print0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement