Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a carriage return as a character to a file?

I wanna have a string like:

blablbabla<carriage return goes here>

I mean the string should contain the carriage return. Is there any simple way to do it? Or if a write a program in c and use fputs with blablabla\r, does this do the trick?

like image 278
wonnie Avatar asked Oct 12 '11 15:10

wonnie


People also ask

How do I insert a carriage return in a text file?

CR and LF are control characters or bytecode that can be used to mark a line break in a text file. CR = Carriage Return ( \r , 0x0D in hexadecimal, 13 in decimal) — moves the cursor to the beginning of the line without advancing to the next line.

How do I type the carriage return symbol?

In Windows, hold Alt and type 013 on the numpad. Show activity on this post. Therefore: To insert a carriage return in bash , you would press Ctrl + V then Ctrl + M.

How do I insert a return character?

Click the cell within the long sentence. 2. Click where we want to insert carriage return, and press the shortcut Alt+Enter.

How do you enter a soft carriage return?

To create a new line without a new paragraph, complete a soft break or soft return on your keyboard by pressing the Shift then Enter keys together. A soft break creates a new line without breaking the paragraph or the list preceding it.


1 Answers

echo -ne "blablbabla\r" > /path/to/your/file

like image 127
Alexander Pogrebnyak Avatar answered Nov 03 '22 01:11

Alexander Pogrebnyak