1

I have the following structure:

Down: This should be down 1
Up: This should be up 1

Down: This should be down 2
Up: This should be up 2 

Down: This should be down 3
Up: This should be up 3

Down: This should be down 4
Up: This should be up 4

Down: This should be down 5
Up: This should be up 5

There I have 5 blocks of two lines, each block separated by one blank line.

I want to flip the order of each block individually while maintaining the order of the blocks.

The example I used should look like this:

Up: This should be up 1 
Down: This should be down 1

Up: This should be up 2
Down: This should be down 2

Up: This should be up 3
Down: This should be down 3

Up: This should be up 4
Down: This should be down 4

Up: This should be up 5
Down: This should be down 5
1
  • 3
    Welcome to SuperUser! We are not a free coding service but a community of people interested in computers that are willing to share their knowledge and experience. If you have already tried something please post it here, otherwise this question is likey to be closed. Feb 21, 2023 at 7:39

1 Answer 1

2

You'd go through following steps:

  • Ctrl+H

  • Find what: (.+)\r\n(.+)

  • Replace with: $2\r\n$1

  • Search mode: Regular expression

  • Click on Replace All (at your own risk)

enter image description here

Please note - MacOS, by default, uses a single carriage return (<CR>), represented as \r. Unix uses a single linefeed (<LF>), \n. Windows uses both, creating a (<CRLF>) combination, \r\n.

If necessary you have to adapt this for your operating system and your requirements.

1
  • Thank you! It's perfect, and it worked just as I expected.
    – triplosete
    Feb 21, 2023 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .