Author image Jeremy Squires
and 1 contributors

NAME

iniedit - edit (or patch) a .ini file.

SYNOPSYS

iniedit [-V] -f file -i file [-o file]

DESCRIPTION

iniedit edits or patches the .ini file specified by the -f option using the patch in the file indicated by the -i option.

If the -o option is used, the result is written the specified file, otherwise the original file is over-written with the result.

The patch file basically lists the keys and fields to add, remove or change - it is typically the result of running inidiff.

OPTIONS

-f file

Specifies the .ini file that is to be patched. A "-" means read the file from standard input.

-i file

Specifies the file containing the .ini patch (usually generated by inidiff). A "-" means the patch should be read from standard input.

-o file

Specifies the file where the result of the edit should be written. A "-" means the patch should be written to standard output. If this option is not specified, the original file is overwritten (if the original file was read from standard input, the result is written to standard output).

-V

Prints the version number - the program then exits immediately.

FILE FORMATS

INI File Format

Disclaimer: this is my understanding of .ini, gained from looking at a few files, and may be incorrect.

Terminology NOTE: The following naming convention is used here:

        [key] field=value

Whereas in other documentation of INI files the naming convention is:

        [section] key=value

Your typical .ini file looks like this:

    ; A comment
    [firstkey]
    field=value         ; More comments
    foo=bar
    
    [Another key name]
    A field=The value
    moreFields="values and ; stuff"

and so on.

In general, .ini files consist of a number of keys, each key has a number of fields, and each field has a value. Key names are inclosed in brackets and appear on a line by themselves - they may contain pretty much any character except brackets. Keys can appear in any order in the file, but no two keys should have the same name.

Field names and their values are separated by an equals. Field names within a key are usually, but not always, unique. Double quotes are (somewhat) special in field names and values: they can be used to quote characters that would otherwise not be allowed (e.g., equals and semi-colon).

Quotes should be balanced (though I've seen some .ini files with a single quote in the value - check your HP printer .ini files).

Blank lines are completely ignored, though they are typically used to separate keys.

Comments in .ini files begin with a semi-colon and go the the end of the line.

Comments may be on lines by themselves or they may appear after a key name or after a field=value.

A semi-colon inside the brackets of a key name is not considered a comment.

Patch File Format

An .ini patch file is mostly the same as an .ini file with the following differences:

  • A minus after a key name (outside the brackets) indicates the key is to be deleted.

  • A minus after a field name indicates the field is to be deleted (the field has no equals and no value).

  • Key names can be repeated - the changes contained in the keys are combined; the last change mentioned wins.

SEE ALSO

inidiff, inicat, inifilter.

AUTHOR

    Michael Rendell, Memorial University of Newfoundland

MAINTAINERS

    Jeremy Squires <j.squires at computer.org>

SOURCE

ACKNOWLEDGEMENTS

    Michael Rendell, Memorial University of Newfoundland
    produced the first version of the Regutils package from which
    this package was derived.

BUGS

Please report any bugs or feature requests to bug-app-inidiff-inifile at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-IniDiff-IniFile. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc App::IniDiff::IniFile

You can also look for information at:

LICENSE AND COPYRIGHT

This software is Copyright (c) 1998 Memorial University of Newfoundland

This is free software, licensed under:

The GNU General Public License, Version 3, July 2007

See LICENSE