Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

With sed, I want every time there's a newline between two lines to be two newlines instead

  1. User

    With sed, I want every time there's a newline between two lines to be two newlines instead

  2. Assistant

    To substitute every newline with two newlines in sed, you can use the following command:

    sed 's/$/\n\n/' your_file.txt > new_file.txt
    

    This command will replace every end of line character ($) with two newline characters (\n\n), effectively doubling the number of newlines in the file. The result will be saved in a new file called new_file.txt.

    Note that you need to use double quotes instead of single quotes if you want to substitute a newline character with sed. Here's how the command would look like with double quotes:

    sed "s/$/\n\n/" your_file.txt > new_file.txt