Jim Peeters
Jim Peeters

Reputation: 2863

How to create a text file with specific text in it in Linux?

I want to do this with 1 line of code :

Create a text file where 3 sentences underneath eachother are placed. I know the command to create an empty textfile it is "cat > sample.txt" but i want to create this file with these 3 sentences in it in one line of code. Like this :

sentence1
sentence2
sentence3

Upvotes: 4

Views: 7321

Answers (1)

haxtbh
haxtbh

Reputation: 3534

echo -e "sentence1 \nsentence2 \nsentence3" >> sample.txt

Upvotes: 9

Related Questions