Is there a way to append text to a text file starting with two line breaks from the command line

430 views Asked by At

I am on FreeBSD 13 using csh and I have a notes.txt file which I would like to be able to append notes to, quickly, from the command line. I would like to be able to add two 'new lines' before each note that I append, in order to separate the notes, making them easier to distinguish from each other. So, my question is "How can I append two new lines before and while appending a string of text to a file and how can I do this from the command line?"

Thanks for any help, -Jonathan

1

There are 1 answers

0
petrus4 On
cat > newnote <<EOF
$a


Your new note.
.
wq
EOF

ed -s notes.txt < newnote