VMware Cloud Community
Czernobog
Expert
Expert

Problem with Executing SSH Command in vCO Workflow - break line \n guilty?

Hi,

I want to execute a SSHCommand within the vCO Appliance, to convert a Unix formatted CSV File (2 lines - header and properties) into Win format. I'm using the perl -p -e 's/\n/\r\n/' < unixfile.txt > winfile.txt command found here: https://kb.iu.edu/d/acux

The command itself runs flawlessly when I start it directly on the vCO Appliance console.

When use this script within the Workflow: mySSHCommand.executeCommand("perl -p -e 's/\n/\r\n/' < unixfile.txt > winfile.txt");  the output is not converted. I guess the reason for this is, that during execution, the '\n' is interpreted as break line and the whole command gets scrambled like this:

perl -p -e 's/

/

/'

I've tried using a string variable as the input for the command:

var SSHstring = "perl -p -e 's/\n/\r\n/' < unixfile.txt > winfile.txt"

mySSHCommand.executeCommand(var SSHstring);

This doesn't remove the problem.

Is it possbile to parse the command somehow, so that the whole string is executed in the vCO command line?

Thanks in advance...

EDIT: It was just me being stuping and copypasting the command, just added another '\' before the escape charcter and it works -_-

0 Kudos
0 Replies