“cmcli getval " + FinalUniqueID + " cmrepo/files CSCFMMConfigTable” this is the code were FinaluniqeID is the variable if it try to write this using the write text File activity in the UiPath the cmrepo/files CSCFMMConfigTable is coming in the next Line means 2nd line, i need all the text to be in the same line. how to resolve this !?
Hi @rakeshcm456
Try as below:-
Assign
YourVar = “cmcli getval " + FinalUniqueID + " cmrepo/files CSCFMMConfigTable” . Replace(Enviornment.newline,“”)
Thanks
Hi @rakeshcm456
Try this:
"cmcli getval " + FinalUniqueID + " cmrepo/files CSCFMMConfigTable".ReplaceLineEndings("")
Let me know if you have any queries.
Regards
It not working the error is string doesnot contain a definition for replacelineEndings and no accessible extension method replacelineEndings accepting the first argument of type string could be found
Hi @rakeshcm456
Try this:
("cmcli getval " + FinalUniqueID + " cmrepo/files CSCFMMConfigTable").Replace(Environment.NewLine, "")
Hope it helps!!
using c. can u please check this above issue
Thankyou its working !!!
Thankyou its working !!
Hope you got the solution, if yes, please mark my post as solution to close the loop or if you have any questions, I’m happy to help.
Regards
Hi @rakeshcm456 You need to use the replace function in the assign activity get the value in the new variable - Below steps you need to do
1 Read the text File in Variable
2 use replace function and allocate this is new variable
`“
// Get the value in variable
Var_Input = cmcli getval " + FinalUniqueID + " cmrepo/files CSCFMMConfigTable”;
// remove the new line
Var_Input.Replace(Environment.NewLine, "");
3 remove all the text
Note: if you want to remove the second line then you need to get the two-line using the regex pattern remove this line and replace the new text
Regex.Match(text,@"^(.*\n.*)").Value.Trim();
@rakeshcm456 You let me know if you have the same issue today or need to optimize your existing solution.