Article 5QW0X Have Perl script move a line up in block/group of lines

Have Perl script move a line up in block/group of lines

by
BudiKusasi
from LinuxQuestions.org on (#5QW0X)
How can a Perl (preferably one-liner) script move a line up in a block/group of lines in file (# be a comment token):

Code:*****
*FOO=
BAR
BAZ
*FOOBAR
**** # Token such above to start over again repeatedly...
to be:

*****
*FOOBAR
*FOO=
BAR
BAZ
***** # Token such above to start over again repeatedly...Have the script to be simplest/minimal as long as it is working correctlylatest?d=yIl2AUoC8zA latest?i=Vsnl3y1GB6E:MtZLPqgeRrU:F7zBnMy latest?i=Vsnl3y1GB6E:MtZLPqgeRrU:V_sGLiP latest?d=qj6IDK7rITs latest?i=Vsnl3y1GB6E:MtZLPqgeRrU:gIN9vFwVsnl3y1GB6E
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments