mIRC Home    About    Download    Register    News    Help

Print Thread
#271629 05/05/23 11:54 PM
Joined: Dec 2019
Posts: 20
S
Stephen Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2019
Posts: 20
Does anyone know if you can use /remini with a wildcard match? so if I wanted to /remini history* would this work?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Not clear what you're wanting to do, since the 1st parameter of /remini is the filename. The syntax for /remini is
removing an entire [section] is /remini filename.ini section
removing just 1 item is /remini filename.ini section item

... so is your example wanting to remove matching filenames, sections, items, or items whose data contains your match?
/remini cannot remove wildcard matches for items and sections because * and ? are valid in stringnames, and /remini does not have a switch to use wildcards. If you're wanting to remove matching sections, you'd need to use $ini to loop through them all and delete them individually if each name matches your wildcard. Note that if you're deleting things found by $ini, you want the loop to go from total-to-zero to avoid complications because deleting the 4th item means there's now a new 4th item which may/may-not be a match.

While you can do the same kind of loop with $ini(file.ini,section,%loopvariable) to find matches, this can be very slow, because if the [section] contains 100 items, it would require 100 disk reads to get each item name, plus another disk write for each match you find.

You can use /filter to find matching wildcard lines, but depending on what your .ini looks like, you could end up removing lines from several [sections]. But you can use hashtables to load 1 [section] into a table, and from there you can use /hdel -s table_name *wildcard* to delete items matching the wildcard. If you need to delete items depending on if the data value matches the wildcard, you could use $hfind. The hashtables page on wikichip has additional info about them beyond what's in F1 help.

So assuming you want to delete all items beginning with 'history', you could do like:

hfree -sw temp
hload -sim temp filename.ini section_name
hdel -sw temp history*
hsave -si temp filename section_name

The 's' switches are just to see messages about what is being done, and can be eliminated. Because hashtables arrange items into buckets, the non-deleted items will look like they're put into random order. You can change -sim to -sim1 to have it use 1 bucket, but if that puts the items in inverse order, and you don't want that, you'd need to /hfree temp, then hload -sim1 again, then hsave -si again to get them in the original order.


Link Copied to Clipboard