Hello,
When my lines contain question mark, I use below command to delete the portion of the matching line coming after question mark:
sed 's/?.*//' SampleFile
SampleFile:
helloworldfirstline?mdksmyymsss
hellosecondlineworld?mdksmkkmsss
thirdhelloworld?mdksmccmsss
Output:
helloworldfirstline
hellosecondlineworld
thirdhelloworld
What if I wish to delete before the question mark in each line?
Expected output1:
mdksmyymsss
mdksmkkmsss
mdksmccmsss
or ...
Expected output2:
mdksmyymsss?
mdksmkkmsss?
mdksmccmsss?
With or without question mark, both are welcome.
Many Thanks
Boris