Wednesday 21 December 2016

bash - Why does my Linux text file (created with echo) end with a newline? How can I remove it?

all experts I facing an issue with adding a new line with sed



I want to add a line into the end of the text file, I tried with




echo "Hello, how are you?" >> myfile.txt


but the issue is its creating extra one more empty line like below



 1 Hello, how are you?
2


so I want it will create 1 line end of the text file line if there is no line into the text file then it will create as a 1st line & all next line will create after the last line without any empty/blank line, T.I.A

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...