[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

System Management Guide: Operating System and Devices


Creating a New Collation Order

Procedure

  1. If you are using a locale source file named gwm, copy the provided locale source file that is closest to the desired character collation order to a file named gwm.src. This name cannot be the same as any previously defined locale. The system-defined locales are listed in Understanding Locale.

    cd /usr/lib/nls/loc
     
    cp en_GB.ISO8859-1.src gwm.src
    
  2. Edit the newly created gwm.src file to change the lines that are associated within the LC_COLLATE category that is associated with the characters you want to change, by typing:

    vi gwm.src
       change
          <a>   <a>;<non-accent>;<lower-case>;IGNORE
          <b>   <b>;<non-accent>;<lower-case>;IGNORE
          <c>   <c>;<non-accent>;<lower-case>;IGNORE
          <d>   <d>;<non-accent>;<lower-case>;IGNORE
       to
          <a>   <d>;<non-accent>;<lower-case>;IGNORE
          <b>   <c>;<non-accent>;<lower-case>;IGNORE
          <c>   <b>;<non-accent>;<lower-case>;IGNORE
          <d>   <a>;<non-accent>;<lower-case>;IGNORE 
    
  3. Generate the new gwm file locale, by typing:

    localedef -f ISO08859-1 -i gwm.src gwm
    
  4. Set the LOCPATH environment variable to the directory containing the new locale. If the new locale is in /u/foo, then type:

    LOCPATH=/u/foo:/usr/lib/nls/loc; export LOCPATH
    

    The default for LOCPATH is /usr/lib/nls/loc.

    Note: All setuid and setgid programs ignore the LOCPATH environment variable.
  5. Change the LC_COLLATE environment variable to the name of the newly defined gwm locale binary, by typing:

    LC_COLLATE=gwm; export LC_COLLATE
    

    Any command now uses the collation order specified in the gwm locale. In the example in step 2, the characters a-d are sorted in reverse order by commands such as ls and sort.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]