Mass edit only parent category

Hey, I want to mass edit this:

And as you can see in the screenshot above I have 1000 like this,
does anyone know how to edit the P only with atom? That would be wonderful!

Thank you so much guys!

Note, only the P700, P701 etc

Create an automation script to batch process?
And/or use a GUI like SearchMonkey to find/replace using regex.
I am in Ubuntu.

That’s the thing, how do I use regex to edit this?

I want to remove ONLY the marked P http://prntscr.com/11ifhba
What regenx cmd I gotta use?

Just to explain the thinking …

I googled this query …

regex delete between patterns then insert pattern

Just one thread of many to read …

So to describe the process …

delete text between patterns P10: and P12:

Then reinsert last pattern P12:

If you have to do this multiple times (“mass edit”) you will need to create a bash or python script which uses variables $first and $last
where $first starts as “P10:”
and $last starts as “P12:”

Your $first and $last sets can be defined in a csv or json file. to loop through