Using GeneWeb with command lines

From GeneWeb
Revision as of 21:46, 20 October 2015 by Henri83 (Talk | contribs) (Creating a base (gwc, gwc1, gwc2))

Jump to: navigation, search
150px-Geographylogo svg.png Language: English • français

Using GeneWeb with command lines assumes that you are familiar with the notions of files, folders and that you are not afraid of entering commands directly in a terminal window. If this was not the case, you should limit yourself to the use of gwsetup which provides a web based interface for most of the needed actions.

Starting a terminal window under Windows 7.

In order to configure and launch GeneWeb, you may use interactive commands in terminal window:

  • a xterm virtual console under Unix/Linux,
  • with cmd.exe under Windows (various ways to start cmd.exe depending on Windows version).

In this window, type the command to position yourself in the folder where GeneWeb is installed (see GeneWeb installation) which could be:

  • under Unix or OSX:
cd /home/user/geneweb/gw/
  • under Windows,:
cd c:\program files (x86)\geneweb\gw

Creating a base (gwc, gwc1, gwc2)

The simple command

gwc
with no parameter, will create an empty base named a (in folder a.gwb in which you can start entering families and persons.

Choosing between gwc, gwc1 ou gwc2 :

  • gwc1 is an alias for gwc ;
  • gwc produces bases using an earlier data format :
  • gwc2 (existing since GeneWeb 5) creates a base using a newer format with separate files for each table, optimized for larger bases.
Usage: gwc|gwc1|gwc2 [options] [files]
where [files] are a list of files:
  source files end with .gw
  object files end with .gwo
and [options] are:
  -c Only compiling
  -o <file> Output database (default: a.gwb)
  -f  Remove database if already existing
  -stats Print statistics
  -nc No consistency check
  -cg Compute consanguinity
  -sep  Separate all persons in next file
  -sh <int> Shift all persons numbers in next files
  -ds <str> Set the source field for persons and families without source data
  -part <file> Particles file (default = predefined particles)
  -mem  Save memory, but slower
  -nolock  do not lock database.
  -nofail  no failure in case of error.
  -q  no verbose
  -v  verbose

The base as defined by the -o option must be in the same partition or device as the current folder, otherwise, gwc will terminate with the following error message:

Uncaught exception: Sys_error("Invalid cross-device link")

Importing a gedcom file (ged2gwb)

The command ged2gwb converts a GEDCOM file into a GeneWeb base.

ged2gwb toto.ged -o dupont
Usage: ged2gwb [<ged>] [options] where options are:
 -o <file>
      Output database (default: "a").
 -f 
      Remove database if already existing
 -log <file>
      Redirect log trace to this file.
 -lf    - Lowercase first names -
      Convert first names to lowercase letters, with initials in
      uppercase.
 -ls    - Lowercase surnames -
      Convert surnames to lowercase letters, with initials in
      uppercase. Try to keep lowercase particles.
 -us    - Uppercase surnames -
      Convert surnames to uppercase letters.
 -fne be - First names enclosed -
      When creating a person, if the GEDCOM first name part holds
      a part between 'b' (any character) and 'e' (any character), it
      is considered to be the usual first name: e.g. -fne '""' or
      -fne "()".
 -efn   - Extract first names -
      When creating a person, if the GEDCOM first name part holds several
      names, the first of this names becomes the person "first name" and
      the complete GEDCOM first name part a "first name alias".
 -no_efn   - Dont extract first names - [default]
      Cancels the previous option.
 -epn   - Extract public names - [default]
      When creating a person, if the GEDCOM first name part looks like a
      public name, i.e. holds:
      * a number or a roman number, supposed to be a number of a
        nobility title,
      * one of the words: "der", "den", "die", "el", "le", "la",
        "the", supposed to be the beginning of a qualifier,
      then the GEDCOM first name part becomes the person "public name" 
      and its first word his "first name".
 -no_epn 
      Cancels the previous option.
 -no_pit  - No public if titles -
      Do not consider persons having titles as public
 -tnd   - Try negative dates -
      Set negative dates when inconsistency (e.g. birth after death)
 -no_nd  - No negative dates -
      Don't interpret a year preceded by a minus sign as a negative year
 -udi x-y   - Undefined death interval -
      Set the interval for persons whose death part is undefined:
      - if before x years, they are considered as alive
      - if after y year, they are considered as death
      - between x and y year, they are considered as "don't know" 
      Default x is 80 and y is 120
 -uin  - Untreated in notes -
      Put untreated GEDCOM tags in notes
 -ds  - Default source -
      Set the source field for persons and families without source data
 -dates_dm 
      Interpret months-numbered dates as day/month/year
 -dates_md 
      Interpret months-numbered dates as month/day/year
 -charset [ANSEL|ASCII|MSDOS] - charset decoding -
      Force given charset decoding, overriding the possible setting in
      GEDCOM

The base as defined by the -o option must be in the same partition or device as the current folder, otherwise, gwc will terminate with the following error message:

Uncaught exception: Sys_error("Invalid cross-device link")

Exporting a GEDCOM file (gwb2ged)

The command gwb2ged will export GEDCOM file from a GeneWeb base.

Usage: ./gwb2ged <base> [options]
If both options -a and -d are used, intersection is assumed.
If several options -s are used, union is assumed.
Options are:
 -charset [ASCII|ANSEL|UTF-8]: set charset; default is UTF-8.
 -o <ged>: output file name (default: a.ged)
 -mem : save memory space, but slower
 -a "<1st_name>" [num] "<surname>": select ancestors of
 -d "<1st_name>" [num] "<surname>": select descendants of
 -aws "<1st_name>" [num] "<surname>" : select ancestors with siblings
 -s "<surname>" : select this surname (option usable several times)
 -nsp : no spouses' parents (for options -s and -d)
 -nn : no (database) notes
 -c <num> :
    When a person is born less than <num> years ago, it is not exported unless
    it is Public. All the spouses and descendants are also censored.

Exporting GW file (gwu)

The command gwu will export from a GeneWeb base a textual file following the GW file format.

gwu dupont > toto.gw

If you save a base into different files after modifications, you haev the possibility of comparing the results with standards tools such as diff.

The GW file format is the preferred method for archiving a base, and the required method to transfer a base from one version of GeneWeb to another.

gwc toto.gw -o durand
Usage: ./gwu [options] <base_file>
If both options -a and -d are used, intersection is assumed.
If several options -s are used, union is assumed.
Options are:
 -o <file>    output file name (else stdout)
 -odir <dir>  create files from original name in directory (else on -o file)
 -mem         save memory space, but slower
 -a "<1st_name>" [num] "<surname>" : select ancestors of...
 -d "<1st_name>" [num] "<surname>" : select descendants of...
 -ad "<1st_name>" [num] "<surname>" : select ancestors of...
   and all their descendants (has no effect if -a and/or -d used,
   option -nsp is forced).
 -aws "<1st_name>" [num] "<surname>" : select ancestors with siblings
 -s "<surname>" : select this surname (option usable several times)
 -maxlev "<level>" : maximum level of generations of descendants
 -nsp : no spouses' parents (for options -s and -d)
 -nn : no (database) notes
 -nopicture : Don't extract individual picture.
 -c <num> :
    When a person is born less than <num> years ago, it is not exported unless
    it is Public. All the spouses and descendants are also censored.
 -old_gw : Do not export additional fields (for backward compatibility: < 7.00)
 -raw raw output (without possible utf-8 conversion)
 -v verbose
 -sep "1st_name.num surname" :
    To use together with the option "-odir": separate this person and
    all his ancestors and descendants sharing the same surname. All the
    concerned families are displayed on standard output instead of their
    associated files. This option can be used several times.
 -sep_only_file <file> :
    With option "-sep", tells to separate only groups of that file.
 -sep_limit <num> :
    When using the option "-sep", groups of families can become isolated
    in the files. Gwu reconnects them to the separated families (i.e.
    displays them to standard output) if the size of these groups is less
    than 21. The present option changes this limit.

Computing consanguinity (consang)

The command consang will compute consanguinity in a GeneWeb base. Display of consanguinity level for each individual is optional and controlled by the variable {{{1}}} in the .gwf parameter file.

consang -i dupont
usage: ./consang -i [options] <file_name>
 -q : quiet mode
 -i : build the indexes again
 -scratch : from scratch
 -mem : Save memory, but slower when rewritting database
 -nolock : do not lock database.

NB : Option « -i » is mandatory, otherwise indexes will not be recomputed and the base will not perform adequately.

The program executes in seconds or minutes depending on the size of your base, and displays a progress bar.

During computation, querying the base is allowed. If you perform a large number of updates on your base, it is recommended that you perform a consanguinity computation from time to time, which has the added benefit of cleaning the base from unused space resulting from suppressions.

Indexing linked pages (update_nldb)

The command update_nldb creates the index of the various auxiliary pages created in notes with the wiki syntax [[[linked_page/displayed text]]]. Listing of these pages is obtained with the gwd command m=MISC_NOTES (see gwd commands).

usage: ./update_nldb [options] <file_name>

Return to the main page of the manual.