Skip to content
Advertisement

I create a file that is time stamped and for some reason I cant get newlines into the file

A few commands I tried are

printf "%sn" >> file$DATE.txt
echo -e "n" >> file$DATE.txt 

What can be going on? Is it because I use Notepad?

Advertisement

Answer

In short, yes.

Notepad only understands DOS line-endings and not Unix line-endings. Use Wordpad or any other more capable editor to see the newlines correctly.

Alternatively, if you do want to create DOS/Windows line-ending files then use rn in the printf call as Barmar indicates in his comment.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement