I have a routine that validates whether a file contains a header. It's good enough to check whether the first line in a file starts with "H".
My routine contains the following code:
Code: Select all
ExCmd = "head -1 ":FilePath:"/":FileName:" | cut -c1"
Call DSExecute("UNIX", ExCmd, Output, SystemReturnCode)
If Output = "H" Then
Ans = "OK"
End Else
Ans = "Error"
End
When I test it the Ans is always "Error". I have added the following code to see what the Output actually is.
Ans = "[":Trim(Output):"]"
It looks there is an extra CR returned after the result (see below). How can I get rid of it?
Result = [H
]