From Beefy Hedgehog, 7 Years ago, written in Plain Text.
- view diff
Embed
  1. no5=`sed -n  -e 5p final.txt | sed -n -e 's/05  //p'`
  2. for i in $no5
  3. do
  4. echo "COPY (SELECT c.id, mc.name AS client, c.answer_time, c.caller_id_number, c.prefix, c.destination_number, c.connect_fee, c.rate, c.duration, c.cost FROM cgrtbilling_cdr_details c INNER JOIN management_client mc ON c.client_id = mc.id WHERE termination ='disabled' AND answer_time BETWEEN '2017-08-23 00:00:00' AND '2017-09-22 23:59:59' AND mc.name ='$i' ORDER BY c.answer_time) TO '/tmp/$i.csv' DELIMITER ',' CSV HEADER;"
  5. done