I have a file which should have specific character/string at the end of each line except the last line. How to achieve this by shell script that it searches that character/string at the end of each line and add that character/string if not present?
For example, the file contents like:
hello1
hello
hell1
hel
end
it should have the character 1 at the end of each line except the last line and the output of our script should be like:
hello1
hello1
hell1
hel1
end
I think it can be written using sed or awk but I am not sure how do they works. Thanks in advance.