0

Replace <br> with a line break in Nano. Tried to Atom - dies. I Inserted \n, \r, \n\r but, inserted simply as characters. How do I insert a line break + taboolation? File is .Html.

Example:

Hello<br>Hello<br>Hello

Result:

Hello
   Hello
   Hello
2

You need to use something like vim instead of nano.

Open the file using vim and press esc and then type:

:s/<br>/\r\t/g

and then press enter

To save the file and exit, run the following sequence of keys which will write the file (save) and quit vim:

press esc and then type:

:wq

and then press enter

Click here to view a related question which explains why this cannot be done using nano.


Alternatively, you could use sed to edit the file.

Here is an example:

I will use the example filename "HELLO":

sed -i 's/<br>/\n\t/g' HELLO

Furthermore, if you want to create a file instead, you can run the following command to create the file by piping the output of sed to a file using tee:

echo 'Hello<br>Hello<br>Hello' | sed 's/<br>/\n\t/g' | tee HELLO
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.