Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
rommy
Contributor III
Contributor III

Issue with tSystem component escape chars

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" ;}

Labels (4)
1 Reply
manodwhb
Champion II
Champion II

@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