| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.1 Program invocation
The format for running the ffe program is:
ffe option … |
ffe supports the following options:
-
-c file -
--configuration=file Configuration is read from file, instead of ‘~/.fferc’ (‘ffe.rc’ in windows).
-
-s structure -
--structure=structure Use structure structure for input file, suppresses guessing.
-
-p output -
--print=output Use output format output for printing. If not given, then the record or structure related output format is used. Printing can be suppressed using format no. Original data is printed using format raw.
-
-o file -
--output=file Write output to file instead of standard output.
-
-f list -
--field-list=list Print only fields and constants listed in the comma separated list list. Order of names in list specifies also the printing order.
-
-e expression -
--expression=expression Print only those records for which the expression evaluates to true.
-
-a -
--and Expressions are combined with logical and, default is logical or. Note that if the same field and operator appear several time in expressions they are always compared with logical or.
-
-X -
--casecmp Expressions are evaluated using case insensitive comparison
-
-v -
--invert-match Print only those records which don’t match the expression.
-
-l -
--loose Normally
ffestops when it encounters an input line or binary block which doesn’t match any of the records in selected structure. Defining this option causesffecontinue despite the error. Note that invalid lines are reported only for text input. In case of binary input next valid block is silently searched.-
-r -
--replace=field=value Replace fields contents with value in output. value can contain same directives as output option
data.-
-d -
--debug All invalid input lines are written to ‘ffe_error_<pid>.log’, where ‘<pid>’ is the process ID.
-
-I -
--info Show structure information in the configuration file and exit successfully. For every structure following information in shown:
Structures: Name, type and maximum record length.
Records: Name and length
Fields: Name, position and length. First position is number one.-
-? -
--help Print an informative help message describing the options and then exit successfully.
-
-V -
--version Print the version number of
ffeand then exit successfully.
All remaining options are names of input files, if no input files are specified or - is given, then the standard input is read.
Expressions (option ‘-e’, ‘--expression’)
Expression can be used to select specific records comparing field values. Expression has syntax fieldxvalue, where x is the comparison operator. Expression is used to compare field’s contents to value and if comparison is successful the record is printed. Several expressions can be given and at least one must evaluate to true in order to print a record. If option ‘-a’ is given all expressions must evaluate to true.
If value starts with string file: then the rest of value is considered as a file name.
Every line in file is used as value in comparison. Comparison evaluates true if one or more values matches, so this makes possible use several different values in comparison. Note: The file size is limited by available memory because the file contents is loaded to memory.
When comparing binary fields the value must have the representation which can be shown using the %d output directive.
Expression notation:
- field=value
Field field is equal to value.
- field^value
Field field starts with value.
- field~value
Field field contains value.
- field!value
Field field is not equal to value.
- field?value
Field field matches the regular expression value.
ffesupports POSIX extended regular expressions.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
