How to move lines containing specific text to top of file in same order as code executed?
Here is the code I have:
printf 'g?_001\|_002\|_003\|_004\|_005?m0\nwq\n' | ed -s target_file
( credit goes to steeldriver for helping me get this far. Truely an amazing user of this site! )
This moves them to the top like so:
or however order they were in originally, just to the top.
but I need them to be put in the same order as I have them in within the
printf and ed
code, so in this case, like:
Anyone familiar with