PowerGrep Help for .slangp Editing Needed

Duimon recommended a program called PowerGrep to me some time ago for editing .slangp files in bulk. I use it all the time now, but need some help with this one if there are any Grep Gurus out there.

I am able to do a search and delete, but what I don’t know how to do is search for lines in a file and then delete all text not included in the search matches… basically an inverse search and delete. Is it even possible? I need to delete everything in a big batch of files, except keep a few lines that I get search hits for.

Any advice on this is appreciated. It’s one of those things that will save me a bunch of time. Thanks.

1 Like

If your text is always the only thing you want to keep, try this…

(.*?)text I'm searching for(.*?)

…using a regular expression search.

and replace with.

text I'm searching for

I suggest copying a file to a temp folder and testing it first.

I also recommend always making a backup of any files you are working with in case something goes really wrong.

I’m not sure it will work if the search text is at the absolute beginning or the end of the file.

1 Like

Thanks for this. I will try it out. The text I want to keep is the first line and the last few lines (the #reference and the image paths).

1 Like

Post an example file and I will try and get it working. As long as the reference line is the only line that ends in .slangp it should be possible. (The image paths will also need a common first few words.)

1 Like
#reference "../../../shaders_slang/bezel/Mega_Bezel/Presets/Base_CRT_Presets/MBZ__1__ADV__GDV.slangp"
HSM_AMBIENT_LIGHTING_OPACITY = "100.000000"
HSM_VIEWPORT_ZOOM = "112.799805"
HSM_VIEWPORT_ZOOM_MASK = "1.000000"
HSM_VIEWPORT_POSITION_X = "0.000000"
HSM_VIEWPORT_POSITION_Y = "155.000000"
HSM_ASPECT_RATIO_MODE = "2.000000"
HSM_ASPECT_RATIO_EXPLICIT = "1.239299"
HSM_INT_SCALE_MAX_HEIGHT = "76.000000"
HSM_NON_INTEGER_SCALE = "93.969833"
HSM_PHYSICAL_SIM_TUBE_DIAGONAL_SIZE = "19.900007"
HSM_USE_IMAGE_FOR_PLACEMENT = "0.000000"
HSM_NON_INTEGER_SCALE_OFFSET = "77.899704"
HSM_SNAP_TO_CLOSEST_INT_SCALE_TOLERANCE = "13.000000"
HSM_SCREEN_POSITION_X = "0.000000"
HSM_SCREEN_POSITION_Y = "-162.000000"
HSM_CROP_MODE = "1.000000"
SHARPEN = "0.100000"
CONTR = "0.040000"
HSM_SCREEN_VIGNETTE_STRENGTH = "30.000000"
HSM_AMBIENT1_SCALE_INHERIT_MODE = "0.000000"
HSM_AMBIENT2_SCALE_INHERIT_MODE = "0.000000"
HSM_FRM_TEXTURE_BLEND_MODE = "1.000000"
HSM_CUTOUT_ASPECT_MODE = "3.000000"
HSM_CUTOUT_FOLLOW_LAYER = "1.000000"
HSM_VIEWPORT_VIGNETTE_MASK_MODE = "0.000000"
HSM_TOP_BLEND_MODE = "0.000000"
HSM_TOP_FOLLOW_FULL_USES_ZOOM = "0.000000"
HSM_INTRO_WHEN_TO_SHOW = "0.000000"
HSM_FRM_OPACITY = "0.000000"
HSM_CRT_LAYER_ORDER = "0.000000"
HSM_CURVATURE_MODE = "0.000000"
HSM_BZL_BRIGHTNESS = "100.000000"
HSM_BZL_COLOR_VALUE = "22"
HSM_REFLECT_GLOBAL_AMOUNT = "10.000000"
HSM_BG_LAYER_ORDER = "3.000000"
HSM_VIEWPORT_VIGNETTE_LAYER_ORDER = "4.000000"
HSM_LED_LAYER_ORDER = "5.000000"
HSM_DEVICE_LAYER_ORDER = "1.000000"
HSM_DEVICELED_LAYER_ORDER = "6.000000"
HSM_DECAL_LAYER_ORDER = "0.000000"
HSM_CAB_GLASS_LAYER_ORDER = "2.000000"
HSM_BG_BRIGHTNESS = "120.000000"
HSM_BZL_COLOR_VALUE = "22.000000"
HSM_BG_AMBIENT_LIGHTING_MULTIPLIER = "68.000000"
HSM_BG_AMBIENT2_LIGHTING_MULTIPLIER = "68.000000"
HSM_BG_SCALE = "108.399872"
HSM_BG_SCALE_X = "100.000000"
HSM_BG_POS_Y = "-15.000039"
HSM_CAB_GLASS_FOLLOW_LAYER = "1.000000"
HSM_CAB_GLASS_BRIGHTNESS = "100.000000"
HSM_CAB_GLASS_AMBIENT_LIGHTING_MULTIPLIER = "68.000000"
HSM_CAB_GLASS_AMBIENT2_LIGHTING_MULTIPLIER = "68.000000"
HSM_CAB_GLASS_SCALE = "145.000610"
HSM_CAB_GLASS_POS_X = "1.150000"
HSM_CAB_GLASS_POS_Y = "-0.250000"
glow = "0.020000"
SIZEH = "2.000000"
SIZEV = "2.000000"
tds = "1.000000"
CS = "3.000000"
CP = "0.000000"
TNTC = "4.000000"
wp_saturation = "1.000000"
dg_support2 = "0.000100"
g_crtgamut = "0.000000"
g_space_out = "0.000000"
g_signal_type = "0.000000"
brightboost1 = "0.950000"
clips = "-0.300000"
gsl = "-1.000000"
shadowMask = "1.000000"
masksize = "1.000000"
maskDark = "0.750000"
maskLight = "1.200000"
maskboost = "3.000000"
BackgroundImage = "../../../Mega_Bezel_Packs/Drybonz/backgrounds/Background.png"
CabinetGlassImage = "../../../Mega_Bezel_Packs/Drybonz/bezels/Alien Syndrome.png"
DecalImage = "../../../Mega_Bezel_Packs/Drybonz/extras/_placeholder back.png"
DeviceImage = "../../../Mega_Bezel_Packs/Drybonz/extras/_placeholder inner.png"

This is an example. I’m trying delete all that stuff in the middle of each of these.

Is this always listed first in the image layer section?

1 Like

I believe so… I’m gonna check a few to make sure.

edit Ok… yeah, I’m sure that one is always going to be first.

1 Like

OK. I don’t know why I can’t get this to work in PowerGrep, but I can in Visual Studio Code.

Open VC go to Edit>Replace in Files.

Browse to the root folder containing your presets, (It will go through folders recursively.) Use *.slangp as files to include.

Make sure to select the regular expression icon in the top right corner of the search box (The rightmost icon)

Then in the search box type

.slangp"
(\n|.)*?
BackgroundImage = 

And in the Replace box type

.slangp"

BackgroundImage = 

Let it search until it shows the results.

Once it lists the results click the “Replace All” icon to the right of the replace box.

1 Like

Ok, thanks for that, Duimon. I admit I’m not too familier with Visual Studio and haven’t looked at it in a while, but I will get it up and running and try this one out. :+1:

I actually can’t seem to get any search results in VC. This is due to my lack of familiarity, but it doesn’t seem to be searching the files from the folder I browse to.

edit Ok… got it working. This was a matter of some embarrassing rookie mistakes that I won’t go into detail about. It worked perfectly and got all my MAME presets cleaned up and refined. I can now change things in just a few files instead of having to Grep all changes in all that mess. Thank you, Duimon… you have helped me yet again.

1 Like