How do I add a new empty line to the beginning of a file under MacOS and Linux?
I have tried the below command and it produces a new line character under MacOS
sed -i.bak '1s/^/TESTe\n/' test.py
How do I add a new empty line to the beginning of a file under MacOS and Linux?
I have tried the below command and it produces a new line character under MacOS
sed -i.bak '1s/^/TESTe\n/' test.py
i
(insert) command rather than thes
(substitute) command - that way, you should be able to avoid the need to specify an explicit line termination – steeldriver Jan 25 '17 at 04:27cp test.py test.py.bak && (echo TESTe; cat test.py.bak) >test.py
– Satō Katsura Jan 25 '17 at 07:15sed -e '1s/^/\n/' filename
– Zumo de Vidrio Jan 25 '17 at 07:55