fork(1) download
  1. #!/bin/bash
  2.  
  3. # ideone boilerplate: run in temp dir
  4. t=$(mktemp -d -t ideone.XXXXXXXX) || exit
  5. trap 'rm -rf "$t"' ERR EXIT
  6. cd "$t"
  7.  
  8. cat <<\: >data.csv
  9. ID,Customer_Name,Cust_ADD
  10. "1",A,CBE
  11. 2,B,POL
  12. 3,C,POL
  13. :
  14.  
  15. cat <<\: >prog.py
  16. import csv
  17. import sys
  18.  
  19.  
  20. csv_file="data.csv"
  21.  
  22. new_content = """This is Loganayaki ,she is trying to append the csv file
  23.  
  24. But she is not able to, she is facing difficulty using shell script
  25.  
  26. she is seeking help to fix this issue, so that she cab complete her task.
  27. she tried few things which is not helping her"""
  28.  
  29. with open(csv_file) as inp:
  30. rows = csv.reader(inp)
  31. writer = csv.writer(sys.stdout)
  32. for lineno, row in enumerate(rows, 1):
  33. if lineno == 2:
  34. row[0] += new_content
  35. writer.writerow(row)
  36. :
  37.  
  38. python3 prog.py
  39.  
Success #stdin #stdout 0.03s 9572KB
stdin
Standard input is empty
stdout
ID,Customer_Name,Cust_ADD
"1This is Loganayaki ,she is trying to append the csv file

But she is not able to, she is facing difficulty using shell script

she is seeking help to fix this issue, so that she cab complete her task.
she tried few things which is not helping her",A,CBE
2,B,POL
3,C,POL