I have a file which has several lines.
I wish to update the file while making sure that the last visible character of each line of the file is a single quote '. In case not, then we should add the single quote at the end of each line.
If the single quote is the last character in a line then leave it as is.
cat test.txt
fahsjhjkhkjhjhajkhjf
afasfsfsfffsfasf'
aaffa' sfff
wfafsfsaffs'
fsafsfs'afffafsasf
Expected output:
fahsjhjkhkjhjhajkhjf'
afasfsfsfffsfasf'
aaffa' sfff'
wfafsfsaffs'
fsafsfs'afffafsasf'