I have few files. For some files the cursor is at the end of last line. For other files, cursor is at the new line at the end.
I want to bring the cursor down to next line for the files that are having cursor at the end of last line
In otherwords, I want to introduce a blank line at the end of line, if it doesn't exist
Here is example.. for test_file cusor is at the end of line3. I want to bring the cursor down to the next line. Then only, I can process that file. Please help me. Feel free to ask me if you unable to understand my requirements
Yes.. it is working fine for the files that doens't have a blank line at the end of file
But, if the file already contains a blank line at the end, the modified file is becoming zero bytes. It shouldn't modify the file, if it already has blank line at the end
Please suggest some thing
$ ls -ltr test2.webM
-rw-r--r-- 1 spamarth users 15010 Nov 5 16:34 test2.webM
$ sed '${/^$/!s/$//;}' test2.webM > ./test2
$ ls -ltr test2.webM test2
-rw-r--r-- 1 spamarth users 15010 Nov 5 16:34 test2.webM
-rw-r--r-- 1 spamarth users 0 Nov 5 16:35 test2
$