Jon Stier
Jon Stier

Reputation: 1

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

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

Upvotes: 0

Views: 471

Answers (1)

petrus4
petrus4

Reputation: 614

cat > newnote <<EOF
$a


Your new note.
.
wq
EOF

ed -s notes.txt < newnote

Upvotes: 0

Related Questions