cgi_to_db man page

cgi_to_db — convert stored CGI files (from to fsdb


    cgi_to_db [-duU] [-e EmptyValue] [cgi-files...]


Converts all stored CGI files (from to fsdb, optionally unescaping the contents. When contents are unescaped, CR NL is recoded as “\n”.

Output is always in fsdb list format with double space (type “S”) field separator.

Unlike most Fsdb programs, the input to this program is  not usually from standard input.  However, the program will take  "-i" options.

This program requires temporary storage equal to the size of the data (so that it can handle the case of different entries having different headers).


-u or --unescape

do unescape data, converting CGI escape codes like %xx to regular characters (default)

-U or --nounescape

do not unescape data, but leave it CGI-encoded

-e E or --empty E

give value E as the value for empty (null) records

-T TmpDir

where to put tmp files. Also uses environment variable TMPDIR, if -T is  not specified. Default is /tmp.

This module also supports the standard fsdb options:


Enable debugging output.

-i or --input InputSource

Read from InputSource, typically a file name, or "-" for standard input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.

-o or --output OutputDestination

Write to OutputDestination, typically a file name, or "-" for standard output, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.

--autorun or --noautorun

By default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The "--(no)autorun" option controls that behavior within Perl.


Show help.


Show full manual.

Sample Usage


file A (TEST/


file B (TEST/



    cgi_to_db TEST/ TEST/


    #fsdb -R C -F S name id email submit_time newfield emptyfield
    name:  test
    id:  111-11-1111
    email:  test\
    submit_time:  Tue Jan 14 11:32:39 2003

    name:  test2
    id:  222-22-2222
    email:  test2\
    newfield:  foo
    emptyfield:  -
    submit_time:  Tue Jan 24 22:32:39 2003

    #  | cgi_to_db TEST/ TEST/

See Also

Fsdb. CGI(3pm). <>. <>


2017-06-05 perl v5.26.0 User Contributed Perl Documentation