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:
name_003 name_005 name_004 name_002 name_001
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:
name_001 name_002 name_003 name_004 name_005
Anyone familiar with