Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All, I am trying to execute unix cmd in tSystem component , however component is throwing an error, Can someone please help me ? Can you point me what I need to do to handle double quote and single quote in a cmd ? I tried escape but its not helping much
Working cmd:
touch /dir/datadir/data.csv ; awk -F'"' 'NF&&NF%2==0{ORS=ORS==RS?" ":RS}1' /dir/datadir/data.csv | tail -n +2> /dir/datadir/temp.csv ; touch /dir/datadir/temp.csv
Talend cmd:
new String[]{"/bin/bash","-c","touch "+context.Dir+"datadir/"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"; awk -F '"' 'NF&&NF%2==0{ORS=ORS==RS?" ":RS}1' "+context.Dir+"datadir/"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+" tail -n +2> "+context.Dir+"datadir/temp.csv ; touch "+context.Dir+"datadir/temp.csv" ;}
@rommy rommy , I really not understand why are you using new String[] ,since Unix or windows will not recognize this.
tSystem will expect the Unix or windows commands.
Please check the below link to execute multiple commands.
https://help.talend.com/r/WDW8rj7PFt0758MiFF7G4Q/hmnldIQpIgPfYz_JjP6IOg
Thanks,
Manohar