I am running a shell build step in Jenkins (Windows), but, it doesn't seem to recognize the rev
command. The command I am trying to run is:
awk '/Connections/||/Endpoint/||/connections/||/endpoint/||/EndPointURI/ {print $config}' "$config" | rev | cut -c 8- | rev >temp11
I have used sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
to replace each instance of rev
.
I have the following:
awk '/Connections/||/Endpoint/||/connections/||/endpoint/||/EndPointURI/ {print $config}' "$config" | sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' | cut -c 8- | sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' >temp11
Using this method, I get the following error in the Jenkins output:
+ awk '/Connections/||/Endpoint/||/connections/||/endpoint/||/EndPointURI/ {print $config}' 'C:\Program Files (x86)\Jenkins/workspace/DeploymentFiles/BUILD.xml'
+ sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
+ cut -c 8-
sed: -e expression #1, char 9: unknown command: `\'
+ sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
sed: -e expression #1, char 9: unknown command: `\'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Not sure how to fix this or make it work.
Full script:
touch "${JENKINS_HOME}"/workspace/DeploymentFiles/UAT.properties
config=${JENKINS_HOME}/workspace/DeploymentFiles/BUILD.xml
properties=${JENKINS_HOME}/workspace/DeploymentFiles/UAT.properties
a='tibco.clientVar.'
awk '/Connections/||/Endpoint/||/connections/||/endpoint/||/EndPointURI/ {print $config}' "$config" | sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' | cut -c 8- | sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' >temp11
awk '/Connections/||/Endpoint/||/connections/||/endpoint/||/EndPointURI/ {getline; print $config}' "$config" |sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' | cut -c 9- | sed '/\n!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' >temp22
sed -e s/'<name>'//g -i temp11
sed -i '/^$/d' temp11
sed -e s/'<value>'//g -i temp22
sed -i '/^$/d' temp22
while read -r line
do
echo "${a}$line"
done <temp11 >temp3
sed -i '/^$/d' temp3
paste -d'=' temp3 temp22 > final
sed '/^tibco.clientVar.<checkpoint>/d' final > final.new && mv final.new final
mv final ${properties}