Code below can, for example ...
[anony@mous-pc ~]$ (printf 'g?%s?m0\n' 008 006 004 002 ; printf 'wq\n') | ed -s file.txt
... take all of numbers within ...
[anony@mous-pc ~]$ cat some.txt
005
003
110
069
002
008
004
245
009
007
006
... and move desired numbers wanted moved (or any other strings) to top in exact order given in code executed, like so:
[anony@mous-pc ~]$ cat some.txt
002
004
006
008
005
003
110
069
245
009
007
How can this code be reversed to make these numbers order at the bottom of the .txt rather than at the top?