After some processing, I have my input file like below.
I need to process the above file further and so I need a line breaker at the end of the line too. Currently, I can accomplish it as below.
sed 's/$/|/' file1.txt
The above command results in the output as,
As we can see, the
| is appended to blank lines too. When I tried to remove the
| character again from blank lines using below command,
sed 's/|//g' file1.txt
| character is getting deleted everywhere. How can I delete only the
| in blank lines? I need to keep the blank line also.