in reply to Re: How to reorder a text file
in thread How to reorder a text file

Dang - Fried Brain Syndrome. How's this?

Input file:
Title 1 Line of text A Line of text B Title 2 Line of text C Title 3 Title 4 Line of text D
Desired Output:
Title 4 Line of text D Title 3 Title 2 Line of text C Title 1 Line of text A Line of text B

Replies are listed 'Best First'.
Re^3: How to reorder a text file
by Anonymous Monk on Jun 11, 2018 at 22:12 UTC
    $ tac file | perl -ne'push@a,$_;if(/^Title\b/){print reverse@a;@a=()}'