*** lsp*** lists the species and selected parameters defined in PHREEQC-format database files.

Usage    lsp <options> [<file1>] [<file2>] [>file3]

Options  [-@=] [-a[=]] [-b=] [-c[=]] [-cd=] [-co=] [-d] [-e] [-f=] [-fl=] [-fr=] [-fro=]
         [-f1[=]] [-f2[=]] [-f3[=]] [-f3sep=] [-f4[=]] [-f4sep=] [-g=] [-h] [-h1] [-i]
         [-k[=]] [-kw=] [-l] [-m] [-n[=]] [-o] [-p] [-pre=] [-q] [-r] [-s] [-t] [-tc] 
         [-td] [-ts] [-v] [-w=] [-x[=]] [-xs]                             

Processing sequence

    either
      preliminary file selection -> species selection -> output selection
    or
      file comparison between two files (<file2> must be present)

    It is assumed that all database files are properly formatted.
    The processing assigns items to the keyword blocks where they are defined.
    Blocks 1-13 are defined by the names of chemical species; blocks 14-25 are
    defined by the names of various expressions or keywords.
    Processing continues until the first END keyword, or it reaches the end-of-file.
    The -m or multi-END option means that processing will always continue to the
    end-of-file.

    Preliminary file selection:

      candidate file selection based on the <file1> file mask using the ripgrep app.
      If <file1> contains "." or "..", these are resolved and then redefine the
      starting (root) directory. Searching always starts in this directory unless
      changed with -cd. The selection descends recursively if the -r option has been set.
      Default file exclusions are *.lsp*, *.ppi, *.pq?, *.all, *.log, *.pdf and *.phr.
      Globs supported are: *, ?, **, {a,b}, [abc] and [!abc]. ** recursively matches
      directories so **/foo matches foo, src/foo, src/foo/a, a/foo.
      Only files containing the string "SOLUTION_MASTER_SPECIES" will be selected
      for the second phase of species selection. The -xs option also EXCLUDES all
      files containing the "SOLUTION" keyword. This filtering can be redefined or
      completely avoided with the -x and -fpre options.
      If the first character of <file1> is an "@", the rest of the string is assumed
      to be the path to a file containing a one-file-per-line list of files to be
      analyzed, bypassing the normal file selection, exclusions and recursion.
      Options: -@, -r, -x, -xs, -cd, -fpre and -kw.

    Species selection:

      further selection based on parsing the candidate files and identifying species and
      their attributes. Lines and blocks with unrecognised or non-database keywords
      will cause problems unless specified with -kw.
      Options: -f, -fl, -i, -p, -g, -kw.

    Output selection: 

      controls what and how much detail is returned.
      The file header normally contains the full filename, and some file attributes:
      last modified date, number of lines and bytes, md5 hash and best-guess encoding.
      Options: -s, -d, -l, -e, -b, -a, -q, -k, -n, -t, -tc, -td, -w, -pre, -f1, -f2, -f3,
      -f4, ><file3>

    File comparison:

      <file1>, <file2>. For finding small differences between files. Either visually with
      WinMerge (Windows) or meld (Linux), or a text-based view with 'diff' or a
      user-provided app. Differences can be based on the original file (-o) or on files
      automatically reformatted with lsp to reduce non-significant differences (the default).
      Options: -c, -o and species selection options.

    Info and help:

      Options: -h or any other options when <file1> is not
      defined, e.g. -f -b will give help on the -f and -b options.
      See https://www.phreeplot.org/lsp/lsp.html for more info.

    Terminal/display setup:

      The preferred encoding is UTF-8 in order to view non-ASCII characters properly so
      your display should be set up as a UTF-8 terminal. This is the default in Linux but
      in Windows requires that your terminal/display is set to Code page 65001. ASCII
      is a subset of UTF-8.

Options

    Options are read from three sources: (i) if found at startup, a one-line file of options
    in the same directory as lsp.exe and named 'lsp.ini'; (ii) a specified one-line file
    (see -@), and (iii) the command line.
    Options are mostly lowercase letters/numbers preceded by a hyphen, sometimes
    with an argument directly following an = sign. If necessary, use double quotes to enclose
    the arguments - the quotes will be removed but spaces will be preserved and shell
    processing avoided. The options are case sensitive.

 -@=[fn] where fn is the path to a one-line file with lsp options just
         like those given on the command line. This line is added to the input
         immediately after the lsp command, e.g. lsp -@="options.txt" -s "*"
         to run the command. Default name is 'lsp.ini' in the curent directory.

 -a[=]   analyze and list all text files found after applying any file filter (other
         than those specifically excluded with -x) including -fpre. Otherwise, the default is to
         focus on normal database files by ignoring any files with the extension .ppi, .pqi, .pqo,
         and .lsp*. However only text files containing a SOLUTION_MASTER_SPECIES block will
         ever be found and analysed. Useful to see which files have been analyzed but not populated.
         -a    normal print out but also shows files rejected after detailed analysis (see -a=2).
         -a=0  prints the names of all the files that were found before any file content filtering.
         -a=1  prints the names of the files selected after the initial file filter.
         -a=2  prints the names of the database files found.
         -a=2x prints the names of the possible database files excluded during the second phase.
         -a=x  prints the names of files matching the file mask but NOT containing SOLUTION_MASTER_SPECIES.
         These last five options inactivate -f1, -f2, -f3 and -f4 and once completed, stop further
         processing. Include the file mask, <file1>, as normal.

 -b[=]   only print and filter species from specified keyword blocks where
         <block_number> ranges from 1-25:

         1   SOLUTION_MASTER_SPECIES (primary)       
         2   SOLUTION_MASTER_SPECIES (secondary)     
         3   SOLUTION_SPECIES                        
         4   PHASES (non-gas)                        
         5   PHASES (gas)                            
         6   SURFACE_MASTER_SPECIES                  
         7   SURFACE_SPECIES                         
         8   EXCHANGE_MASTER_SPECIES                 
         9   EXCHANGE_SPECIES                        
         10  SOLID_SOLUTIONS                         
         11  PITZER                                  
         12  SIT                                     
         13  ISOTOPES                                
         14  ISOTOPE_ALPHAS                          
         15  ISOTOPE_RATIOS                          
         16  RATES                                   
         17  NAMED_EXPRESSIONS                       
         18  CALCULATE_VALUES                        
         19  LLNL_AQUEOUS_MODEL_PARAMETERS           
         20  GAS_BINARY_PARAMETERS                   
         21  MEAN_GAMMAS                             
         22  RATE_PARAMETERS_HERMANSKA               
         23  RATE_PARAMETERS_PK                      
         24  RATE_PARAMETERS_SVD                     
         25  END                                     

         Multiple blocks can be given by a list of integers separated by commas. Ranges 
         indicated by hyphens. No spaces. Enclose in double quotes, e.g. -b="1-6,10,12". "*"= all.
         Default is to print all populated. -b="0" turns off all blocks. -b alone prints
         a list of the block names.

 -c[=]   line-by-line comparison of <file1> and <file2>. The default is to reduce to -f2 (filtered)
         format for the comparison but if -f1 or -f3 options are included then these file formats
         will be used for the comparison and the files saved. Two files only: no wildcards allowed.
         Use -o for direct comparison in the original file format.
         The default level of detail used is -d. Specified options, if any, apply to both files.
         The default comparison apps are 'WinMerge' (Windows) and 'meld' (Linux).
         For full details and options, see their respective documentation.
         If these are apps are not available, 'fc' and 'diff', respectively, are used.
         The "diff" app that comes with the Windows installation may also be used.
         -c=<exe> specifies the file comparison app to use where <exe> is the path to any
         app which has a command line:
           <app> <options> file1 file2
         -co=<options> is used to specify the options. <options> is a string of options to be
         passed to the file comparison app.
         Enclose in quotes if necessary. Reminder: only compares proper database files.
         Options ignored with -c: -a, -k, -r, -v, -w, -x.

 -cd=<dir> changes the starting directory to this directory rather than the
         directory given, or implied, in the <file1> mask. If the recursive (-r) option
         is in force, directories below this starting directory will be searched.
         Directory names must end with a path separator.

 -d      adds more detailed information to the -s option. If available, this includes the log_k 
         value and an indication of whether a non-default analytical expression (ae) or delta_h
         (deltah) value has been defined.

 -e      The greatest detail. Adds the defining equation for species formation
         to the -l option. For RATES blocks, prints the code block for each species. This
         can be slow. With -t also tidies the equation. If used with the reformatting option,
         -f2 -k="asis" -t -e, only chemical equations are reformatted.
         -ts adds a space between the stoichiometric coefficient and the chemical species.

 -f=     -f=<filter> filters the 'species' name in all selected blocks (-b).
         Unlike file globs, the filter only needs to specify a substring, not the whole entity.
         Enclose in double quotes. Within filter patterns, special regex characters may need
         to be escaped if they are to be taken literally, e.g. -f="^Fe\(OH\)3" to find Fe(OH)3
         at the beginning of a species. The filter string is case sensitive unless -i is set.
         Matching is 'greedy'but there are workarounds, e.g. -f="Fe[^H]*H" will stop after

         the first matching H not the last. The filters are primarily intended for UTF-8 files
         and input strings. If necessary, use Notepad++,iconv etc. to convert. For UTF-8 files,
         ensure that the UTF=8 codepage is in force (Windows). This is the default; else use
         the option -g="65001". If necessary, for non-UTF-8 input,replace accented and extended
         characters in the search string with a '.'.


         There are two modes for filtering: a simple regular expression (regex) filter, and a
         set-based filter based on matching species to a set of one or more master species
         (aka 'elements'). The regex filter supports the following if PCRE2 is enabled:
         Metacharacters,  | * + ? \ .
         Character classes [a-z] [^a-z] and UTF-8
         Repetition       {num} {,max} {min,} {min,max} for non-zeros
         Anchor           ^ $
         Shorthand        \t \n \r \s \S \w \W \d \D \x (\x.. for hexadecimals,
                          e.g. \x63 matches "c")
         Lookahead and lookbehind are not supported.


         Multiple regex strings can be joined by 'or' or 'and' logic depending on the separator.
         The 'or' separator is the comma, ',', while the 'and' separator is the ampersand (&).
         Within a single expression, the altenation symbol, '|' can also be used as 'or'.
         No mixing of separators is allowed in the filter string but -f="Fe|Al&SO4" would be allowed.
         So -f="S|F" will select all species containing either S or F including SO4,
         HSO4-, F- and HF. However, it will also match species containing Si, Sr, Fe etc. -f="S&F"
         will match species containing both S and F including species such as SiF6-2 and FeSO4.
         If the filter is to apply to PHASES, use -p to filter on the phase formula. In regex filtering,
         * will select all species and so is not useful as a separate filter string.

         For the regex filter, the additional string is a regex string.
         The set filter matches 'elements' in species formulae and so will distinguish between S and Si.
         Unlike regex expressions, order is not important. Phase formulae are always used. Redox state
         is ignored. Multiple elements can be joined together with with 'or' logic signified
         by a colon (:) separator or by 'and' logic signified by a semicolon (;).
         The phase name is not included in set filtering.
         The set filter ignores the following characters: ()[].:+-_0123456789 in strings as well as
         terminal descriptors between parentheses such as ...(s),...(aq) etc.
         e- is known as E-. To use the set filter for a single element,
         append with a colon (:), e.g. -f="C:". The set filter will attempt to match any output
         but normally this is only useful for blocks 1-13 since these return chemical species
         whereas later blocks return the names of various expressions. However, if you want to force
         items from any whole blocks or individual 'species' to be returned, e.g. for -f2 output,
         add these at the end of the filter string. They are specified first by '<sep>+' to break
         the normal sequence where <sep> is the ongoing separator. This is followed by a list of items
         separated by commas. These items can either be block numbers in brackets, e.g. [19] or ranges
         [14]-[19] (no spaces), or a single alphanumeric string (also depends on -i). The matching of this extra
         strings depend on the ongoing mode (set or regex) and the blocks selected.
         For the set filter, the extra strings must match the whole names of the so-called 'species' including
         charge. For the regex filter, normal regex filtering applies.
         The 'species' names can be seen with the -s option without filtering, e.g.
         -f="H:O:E:Na:K:Mg:Ca:Cl:N:S:C:+[16],[19],[25],log_K_O2" will add these blocks and 'species'.
         For the regex filter, it can match just part of the species.

         The wildcard "*" means 'and any other' elements. Some examples are:
         -f="S" (regex) will match S, Se, Si, Sr, AgHS, Sr+2, H2S(g), Hfo_wHSiO4-2 etc.
         -f="S:" will match pure sulphur species such as S-2 and S2-2.
         -f="S:*" will match all sulphur-containing species.
         -f="C:O" will match: CO, CO2, CO3-2 and O2
         -f="C;O" will match: CO, CO2 and CO3-2
         -f="C;O;*" will match: AgCO3, CaCO3, CO2, HCO3-, Hfo_wHCO3, FCO3Apatite etc
         -f="U:C:O" will match: UO2(CO3)2-2, CO2, O2 etc
         -f="U;C;O" will match: UO2(CO3)2-2, UO2(CO3), Uraninite(c) etc
         The : filters apply to species names or formulae not to their defining equations or to phase
         names. -fl (long filter) searches the whole species string not just the species name.
         The escape (\) character is also supported in the regex filters.
         Enclose the filter string in double quotes to avoid special interpretation of certain
         characters, e.g. : & * ^./& by the OS or shell. If further filtering is required,
         redirect output to a file and then through ripgrep (rg), awk etc., or use -fr directly.
         Filter matches will be colored. Use -tc to turn off.
         Using -fpre= may speed up filtering when many files are being considered and when filtering
         does not involve multinational symbols and varied file encodings.
         UTF-8 files should show either UTF-8-T or ASCII-T as the encoding in the header output.

 -fl="<filter>"  filter long - rather than only filter on the species name as with
         -f, this option searches the whole species string including parameters such as log_k.
         The amount of species information searched is controlled by the -s, -d, -l and -e
         settings. Any match to the line number will refer to the -f1 line number not the
line number in the original file which is displayed. Use -fr for fast line-by-line
         search. See -f for advice on the use of escape characters which also applies here.

 -fpre=["<regex>]" 
         Provides an additional fast pre-filter to reduce the number of files considered
         for the slower, second semantic analysis stage.
         This pre-filter appplies to all text including comments, not just species names.
         A special option is "*" which will copy the setting from -f= but note that
         whereas -fpre= filters on input lines, -f= only filters on species names.
         For example, to select only database files containing tungsten (W), use
         -fpre="^[[:space:]]*W[[:space:]]*" -f="W:" or to pre-filter for a given species,
         -fpre="^Cu3\(OH\)4\+2" should find it.
         Combined with -a=1, this will given a quick list of the selected files.
         This also provides a mechanism for separating the file selection criteria from
         the output criteria.

 -fr="<string>"  a fast filter using ripgrep to search files, line-by-line,
         matching a regex string. Enclose filter string in quotes. The normal separators (:;,&)
         are taken literally. No other action is taken; no file exclusions. For adding options,
         see ripgrep help, lsp -fr="-h"(short) or lsp -fr="--help" (long). ripgrep
         is recursive by default; lsp is not. Add additional ripgrep options including exclsuions
         using -fro= e.g. -fr="^Sb" -fro="-l" to get a list of files which have Sb at the beginning
         of a line. There is no 'and' logic but you can use alternation: -fr="Al.*SO4|SO4.*Al".
         Use -f= for a species-based search and -fl for a long species-based search.
         The file mask can contain a starting directory but wildcards only in the filename.
         See -f for advice on the use of escape characters.

 -fro="<string>"  add options to the line-by-line ripgrep search, -fr=[],
         e.g. -fr="^Sb" -fro="-l" to get a list of files which have Sb at the beginning
         of a line.

 -f1[=<ext>]
         create original <file1> in raw format after removing comments, extra spaces etc.
         Optionally include -f1=<ext> and -pre=<prefix> to redefine the extension and output
         location: <prefix>filename<ext>. Default <ext> is ".lsp1" and <prefix> is the source
         directory. Not with -a=1 or -a=2.

 -f2[=<ext>]
         create a new and reduced file from <file1> after filtering.
         Optionally include -f2=<ext> and -prefix=<prefix> to redefine the extension and output
         location: <prefix>filename<ext>. Default <ext> is ".lsp2" and <prefix> is the source
         directory. Use the -f/-fl and -b filters to select the species and blocks to include,
         e.g. -f="Alkalinity:H:O:E:Na:K:Ca:Mg:N:S:Cl:C".
         Add -t or -ts to tidy the equations and remove non-significant digits and spaces.
         Since the set filter normally filters on chemical 'elements' (SOLUTION_MASTER_SPECIES),
         filtered items will normally only be from blocks 1-13. To add additional blocks or items
         such as LLNL_AQUEOUS_MODEL_PARAMETERS or RATES, use the '+:' feature of the filter
         -f option, e.g. -f2 -f="U:C:O:+[14]-[25]" to add blocks 14-25. Use -k to preserve
         comments (see -k). The database produced is checked for errors. Don"t use with -a=1 or
         -a=2. Details optionssuch as -s, -d etc will be ignored. Normally it is necessary to
         include at least blocks 1 & 2 to prevent database errors.

 -f3[=<idents>]
         create spreadsheet-style file where <idents> is optionally a comma-separated
         list of column names given by their identifiers, e.g. "line,logk,ae,deltah,eq".
         "*" means all remaining identifiers in alphabetic order.
         All <idents> are converted to lowercase; case is therefore not significant.
         No <idents> is the equivalent of "*" and will list all identifiers.
         The level of detail must be at least -s for output.
         The block number and "species" columns are always prepended to the list.
         The comma-separated output file location is: <prefix><filename>.lsp.csv where
         <prefix> is derived from the -pre= option and <filename> is the name of
         the original db file (without extension). Use -f3sep=<sep> to define a
         different output separator where <sep>=<char> and <char> = a single character,
         \t (for tab), or an integer 1-254 defining an ASCII character, e.g. 9 for
         tab. Useful where fields contain commas.
         The normal filters for selecting the species and blocks apply, e.g.:
                 lsp -f3="line,logk,ae,deltah,eq,*" -b=3-6 -e -t "wateq4f.dat"
         or for a full listing:
                 lsp -f3 -e -t "*"
         Not with -a=[n] options.

 -f4[=<ext>]
         create a multi-file table of species vs file after file and species filtering.
         For the -s level of detail and below, only the block summaries are given but
         for -d and above, individual species data are given. Most useful after strong
         species filtering. Optionally include -f4=<ext> to define the extension; default
         is .txt. Default separator for output is a tab. Use -f4sep=<sep> to define
         a different output separator where <sep>=<char> and <char> = a single character,
         \t (for tab), or an integer 1-254 defining an ASCII character, e.g. 9 for tab.
         Note: phase names (e.g. "Hfo (am, aged)") can contain commas making csv
         format an inappropriate separator. Cannot create at the same time as the
         -f1 or the -f2 options. Also not with -a=[n] options. Can be slow.

 -g=     -g=<num> or -g="auto". "auto" dynamically changes the code page
         depending on the probable encoding of the file (Windows only). Use if files
         of different encodings (code pages) are being analysed in one run. Windows
         supports many legacy code pages. For example, 1252 (Western European) is still
         widely used in the US and Western Europe, and 850 was the old MS-DOS Latin-1
         code page. Code page 932 is Shift-JIS, used in Japan. A modern multilingual option
         is UTF-8, available as code page 65001. This is the default in lsp. It is
         now the preferred encoding for displaying multilingual text. However, correct
         display also depends on the terminal expecting UTF-8 input and using a font that
         supports the required characters. Windows Terminal is generally more capable
         than the legacy Windows Console Host (CMD) (including in WSL), particularly
         for Unicode rendering. Use -g="65001" together with UTF-8 encoded files if
         you want to filter text containing accented or foreign characters.
         The default codepage can be changed by entering it in the lsp.ini file (see 
         Help|Options, -h).
         Conversion of files to UTF-8 can be achieved with various apps including
         the Notepad++ text editor and the iconv app (Linux).

 -h1     one line summaries. Use -h for detailed help.

 -h      detailed help. Use -h1 for one-line summaries.

 -i      makes the -f regex filter(s) case-insensitive. Do not use with the set filter.

 -k[=]   -k[="asis"|"above"|"below"] keeps comments in output files.
         By default (no -k), comments and blank lines are removed from f1, f2 and
         species output. -k keeps comments in f1 files and just inline comments with
         block output and at least the -d level of detail. -k defaults to "above"

         for f2. -k="asis" with -f2 is used for line-by-line reformatting of a
         database file retaining all comments and the indent. Used with -t or -ts,
         it tidies equations and numeric values in f2 output. No sorting
         or filtering. The only valid options with this choice are:
         "-a","-e","-f2","-q","-pre","-r","-t","-ts" and "-x".

         The -k="above" and -k="below" options apply to the way that
         comments are attached to blocks and species after sorting.
         Because of the reordering of keyword/species blocks in f2 files,
         there is a choice as to which blocks/species comments lying
         in betweeen two keyword/species blocks should be attached. There
         are two options which are applied throughout a file: (i) comments
         are placed "above" a keyword/species (the default), or (ii)
         comments are placed "below" a keyword/species. Mid-block comments
         are not affected. The following demonstrates these two options:

         original                  -k[="above"]            -k="below"

         #comment 1               #comment 6               SOLUTION_MASTER_SPECIES
         SOLUTION_SPECIES          #comment 7               F F- 0 F 18.9984
         #comment 2                SOLUTION_MASTER_SPECIES   #comment 9
         Na+ + F- = NaF            #comment 8               #comment 10
         -log_k -0.24              F F- 0 F 18.9984          Na Na+ 0 Na 22.9898
                                   Na Na+ 0 Na 22.9898       #comment 8
         #comment 3
         Na+ + CO3-2 = NaCO3-      #comment 1               SOLUTION_SPECIES
         #comment 4               SOLUTION_SPECIES          #comment 2
         -log_k 1.27 #comment 5   #comment 3               Na+ + CO3-2 = NaCO3-
         #comment 6               Na+ + CO3-2 = NaCO3-      #comment 4
         #comment 7               #comment 4               -log_k 1.27 #comment 5
                                   -log_k 1.27 #comment 5   #comment 6
         SOLUTION_MASTER_SPECIES                             #comment 7
         Na Na+ 0 Na 22.9898       #comment 2
         #comment 8               Na+ + F- = NaF            Na+ + F- = NaF
         F F- 0 F 18.9984          -log_k -0.24              -log_k -0.24
                                                             #comment 3
         #comment 9               #comment 9
         #comment 10              #comment 10              PHASES
         PHASES                    PHASES                    Halite
         Halite                    Halite                    #comment 11
         #comment 11              #comment 11              NaCl = Cl- + Na+
         NaCl  =  Cl- + Na+        NaCl = Cl- + Na+          log_k 1.570
         log_k   1.570             log_k 1.570               -delta_h 1.37
         -delta_h  1.37            -delta_h 1.37             #comment 12
         #comment 12

         Adjacent comments are treated as one comment block and are moved together.
         "Orphan" comments such as comment 1 with "below", and comment 12 with
         "above" are omitted. Use "#" alone to insert blank comment lines.
         This default behaviour can be overridden for individual comment blocks
         by adding a special symbol immediately after the #in any of the
         comments of that block. The special symbols are: "<" for "above" and
         ">" for "below" signalling that the comment is above or below the
         adjacent keyword/species, e.g. if -k="above" then

         ...
         SOLUTION_MASTER_SPECIES
         #> Comment 1
         #Comment 2
         SURFACE_MASTER_SPECIES
         ...
         will place this comment block below SOLUTION_MASTER_SPECIES.
         All lines following the first END are considered as comments.

 -kw=    where -kw=<list> and <list> is a list of PHREEQC keywords separated by commas
         that are not recognised by this version of lsp but are present in the database files,
         e.g. -kw="NEW_KW1,new_kw2". These keyword blocks will be treated as non-database
         blocks, i.e. read but skipped. This prevents their data corrupting earlier blocks and
         provides some degree of future-proofing as new keywords are introduced into PHREEQC.

 -l      adds source line numbers and more identifiers to the details (-d) output.
         Line numbers refer to the first line of the definition of the item. For RATES blocks,
         also adds the crc (cyclic redundancy check) for each block to help identify differences.

 -m      multi-END. Does not stop processing at the first END keyword.

 -n[=]   display species by their canonical formula (ordered and parenthesis-free),
         "elements" are ordered according to various schemes (see below). Neutral species are
         normalized to a coefficient of one for the first "element", e.g. UO2 and U2O4 both become
         UO2. Phase formulae are NOT canonicalized if the primary display is the phase name, i.e. -p
         has not been set. The [] order in e.g. isotope species will be lost and so may degenerate.
         -n="e" master species sorted by electronegativity (default).
         -n="c" master species sorted by the "Standard order of arrangement" (CODATA).
         -n="a" master species sorted alphabetically.

 -o      line-by-line comparison of two files in their original format otherwise in lsp
         format using the options given on the command line.

 -p      use PHASE formulae as the primary output (and filter) rather than the phase names,
         i.e. name<formula.

 -pre=   prefix. Directory for the -f1, -f2 and -f3 output files. A trailing file
         separator is required. The directory must already exist. Default is the same directory
         as the file being analysed. This directory is prepended to the output filename.

 -q      quiet mode - eliminates screen output, apart from error messages.
 -r      recursively searches sub-directories of <file1> file mask. Default is off.

 -s      individual species names are printed.

 -t      tidy - removes trailing zeros from chemical equations, log_k"s,
         ae"s etc including for f2 & f3 (but not f1) output. Also converts all
         charge formats to the M[+-][n] notation, e.g. Th++++ to Th+4, SO4-- to SO4-2.
         -ts is the same but adds a space between the stoichiometric coefficient
         and species in equations.

         To tidy a file line-by-line keeping comments, combine -f2 with -k="asis".
         In addition, add -e if only the equations are to be reformatted keeping
         all other lines as in the original file.

 -tc     turns off colorizing of filter output.

 -td     tidy date - removes the second line (with date, time, md5 etc) from output.
         For -f2, does not add header comments. Also does not include date/time in f4 filename.
         Useful when diff'ing output.

 -v      version info

 -w=     maximum width of screen output. If a line is longer than this,
         it is truncated and wrapped to the next line. Special case: w=0 forces one
         entry per line with trimming, however short or long. Default is w=120.

 -x[=]   -x="<string>" exclude file names matching this glob from analysis.
         All globs are relative to the starting directory. To exclude a whole directory,
         end with a *. If more than one pattern is wanted (OR logic), separate definitions
         by a |, e.g.-x="*.txt|*.csv" to exclude all files with the .txt or .csv
         extension. These exclusions are in addition to the normal exclusions (*.lsp* etc)
         unless no additional exclusions are specified here (-x). In this case, there are
         no exclusions at all, not even the SOLUTION_MASTER_SPECIES block.

 -xs =   -xs also excludes all files containing the "SOLUTION" keyword  during
         the preliminary file filtering. Minimizes analyzing non-database files.

Input and output files:

 <file1>
         This controls which directory or file to search. It can be a 
         valid directory with a trailing file separator (\), a file mask including a
         glob pattern, or a specific file. If a directory is given and found, all files
         within it will be searched. The search may extend further down the directory structure
         if the recursive (-r) option is set. For example, "*", "*.dat", "*phreeqc*"
         "*.[dt][ax]t" or "..". For a specific file, enter the fully qualified filename.
         By default, searching will start in the current directory.
         For more flexibility, used the -cd option to set the start directory explicitly.

 <file2> is only used when comparing two files. This file is compared with <file1>.

 > <file3> redirects all screen output to <file3>. Can also append other post-processing
         commands such as piping with |. No spaces are allowed before or after an = sign in
         options. The options are case sensitive. File names case sensitivity follow the OS convention.
         Options and arguments can be quoted to preserve spaces and to avoid shell processing. These
         quotes are discarded. If binary files are detected, they are not analysed.
         If no <file1> is given and there is just one option, the help for that option is given.

         There is increasing information going from:
         lsp "*"
         lsp -s "*"
         lsp -d "*"
         lsp -l "*"
         lsp -e "*"

         Files analyzed   = files analysed after discarding binary files and excluded files.
         Files populated  = files found with at least one PHREEQC keyword data block of interest
         and satisfying the block and species filtering. To see just a list of the files found
         including those normally excluded, i.e. *.lsp* and .pq*, set -a=1. To see just those
         populated, set -a=2.

Input and output files:

 <file1>
         This controls which directory or file to search. It can be a 
         valid directory with a trailing file separator (\), a file mask including a
         glob pattern, or a specific file. If a directory is given and found, all files
         within it will be searched. The search may extend further down the directory structure
         if the recursive (-r) option is set. For example, "*", "*.dat", "*phreeqc*"
         "*.[dt][ax]t" or "..". For a specific file, enter the fully qualified filename.
         By default, searching will start in the current directory.
         For more flexibility, used the -cd option to set the start directory explicitly.

 <file2> is only used when comparing two files. This file is compared with <file1>.

 > <file3> redirects all screen output to <file3>. Can also append other post-processing
         commands such as piping with |. No spaces are allowed before or after an = sign in
         options. The options are case sensitive. File names case sensitivity follow the OS convention.
         Options and arguments can be quoted to preserve spaces and to avoid shell processing. These
         quotes are discarded. If binary files are detected, they are not analysed.
         If no <file1> is given and there is just one option, the help for that option is given.

         There is increasing information going from:
         lsp "*"
         lsp -s "*"
         lsp -d "*"
         lsp -l "*"
         lsp -e "*"

         Files analyzed   = files analysed after discarding binary files and excluded files.
         Files populated  = files found with at least one PHREEQC keyword data block of interest
         and satisfying the block and species filtering. To see just a list of the files found
         including those normally excluded, i.e. *.lsp* and .pq*, set -a=1. To see just those
         populated, set -a=2.

Examples
========

 lsp wateq4f.dat                    outputs a summary of the major PHREEQC database-related
                                    keywords found in the file wateq4f.dat in the current
                                    directory.
 lsp -s wateq4f.dat                 as above but includes a list of all species.
 lsp -d wateq4f.dat                 as above but appends details including key parameter
                                    values (e.g. log_k"s).
 lsp -l wateq4f.dat                 as above but appends line numbers and analytical
                                    expressions.
 lsp -e -w=0 wateq4f.dat            comprehensive species output including defining
                                    equations, all in one species per line format.
 lsp -s -b="4,5" wateq4f.dat        outputs all the PHASES (solids and gases) in wateq4f.dat.
 lsp -r -s "*.dat" >lsp.csv         recursively outputs a list of all species in all *.dat 
                                    files in the current directory and all sub-directories
                                    and sends results to lsp.csv.
 lsp -r -p -s -f="U" "*"            recursively find all U species in all files (regex).
 lsp -r -p -d -f="U.*CO3" "*.dat"   outputs details for all U-CO3 species in .dat files (regex)
 lsp -r -p -s -f="U|Fe,CO3" "*"     all species containing U, Fe or CO3 (regex)
 lsp -r -p -s -f="U|Fe&CO3" "*"     all species containing (U or Fe) and CO3 (regex)
 lsp -r -p -s -f="C" "*"            all species containing the letter C (C, Ca, Cr, Cs, Cu....) (regex).
 lsp -r -i -s -b=4 -f="Calcite" "*" search for phase names containing Calcite, calcite etc (regex).
 lsp -r -fr="Bénézeth" "*"          all lines containing "Bénézeth" (fast regex).
 lsp -r -s -f="C:*" "*"             set all C-containing species (set).
 lsp -r -s -f="C:O" "*"             all species containing only C and/or O (set).
 lsp -r -s -f="C;O" "*"             all species containing C and O and no other elements (set).
 lsp -r -s -f="C;O;*" "*"           all species containing C and O and any other elements (set).
 lsp -r -s -x="\.dat$,\.txt$" "*"   analyse all files in the current directory and
                                    sub-directories but excluding files with extension .dat and .txt.
 lsp -d -c new.dat old.dat          compare line-by-line after reducing both files to lsp -d
                                    format. Then send the output to "WinMerge" if found else
                                    "fc" or if set, an explicit -c=<app>.
 lsp -c="diff" -co="-wB -C 0" -o "old.dat" "new.dat"
                                    compare new.dat and old.dat in their original formats using
                                    the "diff" program. Ignore white space and blank lines;
                                    output no extra context lines with diff.
 lsp -c="winmergeu.exe" -co="/cfg DiffContextV2=0" file1 file2
                                    output no extra context lines with WinMerge.