### Example Human-Readable Output from FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This example shows the formatted, human-readable output produced by FFE using the 'nice' output definition. Each record and its fields are clearly presented with custom headers and indentation. ```Text personel - header - personnel.fix - 1 type=H date=2006-02-25 personel - employee - personnel.fix - 2 EmpType=E FirstName=John LastName=Ripper Age=023 personel - boss - personnel.fix - 3 EmpType=B FirstName=Scott LastName=Tiger Age=045 personel - employee - personnel.fix - 4 EmpType=E FirstName=Mary LastName=Moore Age=041 personel - employee - personnel.fix - 5 EmpType=E FirstName=Ridge LastName=Forrester Age=031 personel - trailer - personnel.fix - 6 type=T count=0004 ``` -------------------------------- ### Example SQL INSERT Statements from FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This is an example of the SQL output generated by FFE using the 'sql' output definition. It includes `DELETE` statements, followed by `INSERT` statements for employee and boss records, and finally `COMMIT` and `quit` commands. ```SQL delete table boss; delete table employee; insert into employee values('john','Ripper','23'); insert into boss values('Scott','Tiger','45'); insert into employee values('Mary','Moore','41'); insert into employee values('Ridge','Forrester','31'); commit quit ``` -------------------------------- ### Example XML Output from FFE Transformation Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This is an example of the XML output generated by FFE using the 'xml' output definition and the `personnel.sep` input file. It shows how the data records (header, employee, boss, trailer) are mapped to corresponding XML elements. ```XML
H 2006-02-25
E john Ripper 23 B Scott Tiger 45 E Mary Moore 41 E Ridge Forrester 31 T 0004 ``` -------------------------------- ### Extract and format data to XML using ffe Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This example demonstrates running `ffe` with the specified configuration file (`personnel.fferc`) and input data file (`personnel`). It processes the fixed-length data and outputs it in the configured XML format, showing the extracted fields wrapped in XML tags as defined in the configuration. ```bash ffe -c personnel.fferc personnel ``` ```xml john Ripper 23 Scott Tiger 45 Mary Moore 41 ``` -------------------------------- ### Display FFE Defined Structures and Outputs Source: https://context7.com/timosavi/ffe/llms.txt This command shows all currently defined structures and their associated output configurations within the FFE tool. It requires a configuration file (~/.fferc in this example) to be specified using the -c flag and uses the -I flag to initiate the structure inspection. ```bash ffe -c ~/.fferc -I ``` -------------------------------- ### Example HTML Table Output from FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This is an example of the HTML table generated by FFE using the 'html' output definition. It displays selected personnel data in a tabular format, suitable for embedding in web pages. ```HTML
FirstName LastName Age
John Ripper 023
Scott Tiger 045
Mary Moore 041
Ridge Forrester 031
``` -------------------------------- ### Process Fixed-Length Records with FFE Source: https://context7.com/timosavi/ffe/llms.txt This example illustrates how FFE parses fixed-width format files by specifying exact field positions and lengths within the configuration. It defines a 'payroll' structure with fixed-length fields and processes a sample 'payroll.dat' file, demonstrating custom output formatting. ```bash # Sample fixed-length input (payroll.dat) # John Doe 00075000 # Jane Smith 00068000 # Configuration file structure payroll { type fixed record employee { field FirstName length 10 field LastName length 10 field Salary length 8 } } output formatted { separator ": " data "Name: %t %t, Salary: $%t" } # Process with custom output format ffe -c ~/.fferc -s payroll -p formatted payroll.dat # Output: # Name: John Doe, Salary: $00075000 ``` -------------------------------- ### Replace Records and Write Fixed-Format File Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Demonstrates using FFE command-line to filter and replace specific records (-r flag) and output to a new file with fixed-format directive. The example filters for boss records (EmpType=B) and writes personnel data to a new file. ```Bash $ffe -p fixed -r EmpType=B -o personnel.fix.new personnel.fix $cat personnel.fix.new H2006-02-25 BJohn Ripper 023 BScott Tiger 045 BMary Moore 041 BRidge Forrester 031 T0004 ``` -------------------------------- ### Replace FFE Field Values in Output Source: https://context7.com/timosavi/ffe/llms.txt This example demonstrates how to use FFE's replace option (`-r`) to alter field values in the output without modifying the original input file. It shows both single and multiple field replacements, useful for data anonymization or standardization. ```bash # Replace sensitive salary data ffe -s employees -r "Salary=REDACTED" employees.csv # Output: # John,Doe,Engineering,REDACTED # Jane,Smith,Marketing,REDACTED # Bob,Johnson,Sales,REDACTED # Multiple replacements ffe -s employees -r "Department=Dept A" -r "Salary=***" employees.csv # Output: # John,Doe,Dept A,*** # Jane,Smith,Dept A,*** # Bob,Johnson,Dept A,*** ``` -------------------------------- ### Example Filtered HTML Table Output from FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This is an example of the HTML table generated by FFE after applying a filter. Only the record where `FirstName` is 'Scott' is included, demonstrating the result of the expression-based filtering. ```HTML
FirstName LastName Age
Scott Tiger 045
``` -------------------------------- ### Define Common FFE Configuration Syntax Elements Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This snippet illustrates the general syntax used in FFE configuration files. It includes examples for comments, command execution, constant and filter definitions, and the basic layout for structure, output, and lookup blocks. This syntax forms the foundation for defining data processing rules. ```FFE Config #comment `command` const name value filter name value … structure name { _option value_ … … record name { _option value_ … … } record name { _option value_ … … } … } structure name { … } … output name { _option value_ … … } output name { … } … lookup name { _option value_ … … } lookup name { … } ``` -------------------------------- ### FFE Input Preprocessor Configuration with FFEOPEN Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Configure FFE input preprocessor using the FFEOPEN environment variable with a command that includes %s placeholder for the filename. The preprocessor should output the processed file contents to standard output. This example uses lesspipe to automatically decompress zipped input files before FFE processing. ```bash export FFEOPEN="/usr/bin/lesspipe %s" ``` -------------------------------- ### Before and After Anonymization Data Example Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Shows original fixed-width personnel data with employee records (John Ripper, Scott Tiger, Mary Moore, Ridge Forrester) and the corresponding anonymized output where names are hashed and ages are randomized while structure and record identifiers remain unchanged. ```text Original: H2006-02-25 EJohn Ripper 23 BScott Tiger 45 EMary Moore 41 ERidge Forrester 31 T0004 Anonymized: H2006-02-25 EJQIQ9C5oBR2rDU0qiSTv7E62 BSqUcsYzSTTNTuTraspsG4154 EMTsXkHltVMsV8qmK1tkgq 00 ER1e90zv1dFjP4 xgflVGQF87 T0004 ``` -------------------------------- ### Extract Data from Binary Files with FFE Source: https://context7.com/timosavi/ffe/llms.txt Configure and process binary files by specifying field types, lengths, and endianness (big-endian or little-endian). This example defines a binary record structure with header and data sections, extracting typed fields and formatting output with custom separators. ```bash # Configuration for binary structure structure binary_record { type binary record header { id 1 "\x01\x00" field RecordType type char length 2 field RecordCount type int length 4 endian big } record data { id 1 "\x02\x00" field Value1 type uint length 2 endian little field Value2 type float length 4 endian big field Flags type hex length 1 } } output binary_out { separator ":" data "Type=%t,Count=%t,V1=%t,V2=%t,Flags=%t" } # Process binary file ffe -s binary_record -p binary_out data.bin # Output depends on binary content structure ``` -------------------------------- ### Define FFE Structure Block Syntax for Input Files Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This example shows the basic syntax for defining a 'structure' block in FFE, which specifies the content and organization of an input file. Structures can contain various options and nested 'record' definitions, allowing for complex data parsing. This block is crucial for processing structured data from files. ```FFE Config structure name { _option value_ … … } ``` -------------------------------- ### Select Specific Fields with FFE Source: https://context7.com/timosavi/ffe/llms.txt This snippet shows how to extract only specific fields from records using FFE's field-list option (`-f`). It includes examples of selecting a subset of fields and combining field selection with expression-based filtering for more targeted data extraction. ```bash # Select only specific fields ffe -s employees -f "FirstName,LastName" employees.csv # Output: # John,Doe # Jane,Smith # Bob,Johnson # Combine field selection with filtering ffe -s employees -f "FirstName,Salary" -e "Salary^7" employees.csv # Output: # John,75000 # Bob,72000 ``` -------------------------------- ### FFE Fixed Length Personnel File Example Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Sample fixed-length personnel data file with header record (H), employee records (E), boss records (B), and trailer (T). Each line is identified by the first byte character, followed by space-padded fields for names and numeric age values. This demonstrates the input format that matches the personel_fix structure definition. ```text H2006-02-25 EJohn Ripper 23 BScott Tiger 45 EMary Moore 41 ERidge Forrester 31 T0004 ``` -------------------------------- ### Filter Records Using Regular Expressions in FFE Source: https://context7.com/timosavi/ffe/llms.txt Apply POSIX extended regular expression patterns to filter records based on field values. This example demonstrates email domain matching and phone number format validation. ```bash # Configuration structure employees { type separated "," record employee { field Email field Phone field Department } } # Filter by regex pattern ffe -s employees -e "Email?.*@company\\.com$" employees.csv # Matches only emails ending with @company.com # Filter phone numbers matching pattern ffe -s employees -e "Phone?^\\+1-[0-9]{3}-[0-9]{3}-[0-9]{4}$" employees.csv # Matches North American phone format ``` -------------------------------- ### Output FFE Processed Data to a Single CSV File Source: https://context7.com/timosavi/ffe/llms.txt This example demonstrates how to redirect the output of FFE processing to a specific file (output.csv) instead of standard output. The -o flag is used to specify the output file, while the -s flag ensures strict processing of the employees.csv data using the 'employees' structure. ```bash ffe -s employees -o output.csv employees.csv ``` -------------------------------- ### Display Separated Data File Content Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This shell command displays the content of `personnel.sep`, a comma-separated file used as input for FFE processing examples. It shows various record types identified by a leading character (H for header, E for employee, B for boss, T for trailer). ```Bash $cat personnel.sep ``` -------------------------------- ### Anonymize Sensitive Data Fields in FFE Source: https://context7.com/timosavi/ffe/llms.txt Apply data anonymization techniques (HASH, MASK, RANDOM) to sensitive fields like SSN and credit card numbers. This example demonstrates configuring anonymization rules and processing CSV data to replace sensitive information with masked or hashed values. ```bash # Configuration with anonymization anonymize customer_anon { method SSN HASH 0 11 method CreditCard MASK 12 16 "*" } structure customer_data { type separated "," record customer { field Name field SSN field CreditCard } } # Input (customers.csv) # John Doe,123-45-6789,4532-1234-5678-9012 # Jane Smith,987-65-4321,5678-9012-3456-7890 # Apply anonymization ffe -s customer_data -A customer_anon customers.csv # Output (hashed SSN, masked credit card): # John Doe,3a4b5c6d7e8f,4532-1234-****-**** # Jane Smith,9z8y7x6w5v4u,5678-9012-****-**** ``` -------------------------------- ### CSV Data Processing with Lookup in FFE Source: https://context7.com/timosavi/ffe/llms.txt Process CSV files using FFE with lookup functionality to enrich data from external sources. This example demonstrates loading payroll codes and matching them against employee records to append department names. Input is a comma-separated CSV file, output includes enriched data with matched lookup values. ```bash # Input file (payroll_codes.csv) # John,Doe,ENG # Jane,Smith,MKT # Process with lookup ffe -s payroll_codes -p with_lookup payroll_codes.csv # Output: # John|Doe|Engineering Department # Jane|Smith|Marketing Department ``` -------------------------------- ### FFE Fixed Length Structure Definition Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Define a fixed-length file structure in FFE with multiple record types (header, employee, boss, trailer), each identified by a specific first byte. Records can reuse fields from other records using 'fields-from' keyword. Field formatting options like %03d pad numbers with zeros. This example parses a personnel file with employee records and calculated field widths. ```conf structure personel_fix { type fixed record header { id 1 H field type 1 field date 10 } record employee { id 1 E field EmpType 1 field FirstName 9 field LastName 13 field Age 2 * * * "%03d" } record boss { id 1 B fields-from employee } record trailer { id 1 T field type 1 field count 4 } } ``` -------------------------------- ### Run ffe with output file and input files Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This command illustrates the general syntax for invoking `ffe` from the command line. It specifies an optional output file using the `-o` flag and one or more input files for processing. If the output file option is omitted, `ffe` writes the processed data to standard output. ```bash ffe -o OUTPUTFILE INPUTFILE… ``` -------------------------------- ### Execute FFE with Lookup Table Output Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Runs FFE with the 'nice' output profile to display personnel records with lookup table translations for the EmpType field. Output is indented and formatted with record headers and field values. ```Bash $ffe -p nice personnel.fix personel_fix - header - personel_fix - 1 type=H date=2006-02-25 personel_fix - employee - personel_fix - 2 EmpType=E (Not a Boss!) FirstName=John LastName=Ripper Age=023 ``` -------------------------------- ### Configure FFE for SQL INSERT Statements Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This FFE output definition generates SQL `INSERT` statements from the parsed data. It includes file headers and trailers for `DELETE` and `COMMIT` commands, defines the record header for `INSERT INTO`, and specifies that only `FirstName`, `LastName`, and `Age` fields should be printed, excluding header/trailer records. ```FFE Configuration output sql { file_header "delete table boss;\ndelete table employee;\n" record_header "insert into %r values(" data "'%t'" separator "," record_trailer ");\n" file_trailer "commit\nquit\n" no-data-print no field-list FirstName,LastName,Age } ``` -------------------------------- ### Configure Field Anonymization in FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Defines anonymization rules for personnel data fields. FirstName and LastName use HASH method starting from byte 2 (preserving first letter), Age uses NRANDOM for random 2-digit numbers. Configuration applies to named structure 'personnel'. ```FFE anonymize personnel { method FirstName HASH 2 method LastName HASH 2 method Age NRANDOM } ``` -------------------------------- ### Generate XML Output from Separated File using FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This shell command demonstrates how to use the FFE tool to process the `personnel.sep` file and produce XML output. It applies the 'xml' output definition, assuming the FFE configuration is saved in `~/.fferc`. ```Bash ffe -p xml personnel.sep ``` -------------------------------- ### Define Fixed-Format Output with Directive Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Creates a simple fixed-format output definition using the %D directive to print all fields in fixed-length format. This is the most basic output configuration for preserving field alignment in the original file structure. ```FFE Configuration output fixed { data "%D" } ``` -------------------------------- ### Generate SQL INSERT Statements using FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This shell command executes the FFE tool to process the `personnel.sep` file and produce SQL `INSERT` statements. It utilizes the 'sql' output definition to generate database-ready commands for populating tables. ```Bash ffe -p sql personnel.sep ``` -------------------------------- ### Define ffe configuration for XML output Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This configuration file (`personnel.fferc`) defines how `ffe` should extract and format data. It specifies a 'fixed' type structure named 'personel' with fields for 'FirstName' (9 chars), 'LastName' (13 chars), and 'Age' (2 chars), and configures XML output formatting including file, data, and record headers/trailers with an indent. ```bash cat personnel.fferc ``` ```ffe-config structure personel { type fixed output xml record person { field FirstName 9 field LastName 13 field Age 2 } } output xml { file_header "\n" data "<%n>%t\n" record_header "<%r>\n" record_trailer "\n" indent " " } ``` -------------------------------- ### Map Values with FFE Lookup Tables Source: https://context7.com/timosavi/ffe/llms.txt This snippet illustrates how to define and utilize lookup tables in FFE configuration to map coded field values to more descriptive labels. It demonstrates a lookup table 'dept_names' with pairs and a default value, then applies it within a record structure for transformation during extraction. ```bash # Configuration with lookup table lookup dept_names { pair "ENG","Engineering Department" pair "MKT","Marketing Department" pair "SAL","Sales Department" default-value "Unknown Department" } structure payroll_codes { type separated "," record employee { field FirstName field LastName field DeptCode lookup dept_names } } output with_lookup { separator "|" data "%t|%t|%l" } ``` -------------------------------- ### Map Field to Lookup Table and Configure Output Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Associates a lookup table with a field definition and creates a formatted output that displays lookup values alongside original data. The configuration uses format specifiers (%n=%t) for field names and values, with indent and justification options. ```FFE Configuration structure personel_fix { type fixed record header { id 1 H field type 1 field date 10 } record employee { id 1 E field EmpType 1 Type field FirstName 9 field LastName 13 field Age 2 } record boss { id 1 B fields-from employee } record trailer { id 1 T field type 1 field count 4 } } output nice { record_header "%s - %r - %f - %o\n" data "%n=%t\n" lookup "%n=%t (%l)\n" justify = indent " " } ``` -------------------------------- ### Universal CSV Reader with Command Substitution Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Creates a dynamic FFE configuration that reads CSV files with variable field counts using command substitution. The field count is determined from the first line of the input file using awk, making the configuration work with any CSV structure. ```FFE Configuration structure csv { type separated , header first record csv { field-count `awk "-F," 'FNR == 1 {print NF;exit;}' $FFE_FIRST_FILE` } } output default { file_header "Files: `echo $FFE_FILES`\n`date`\n" data "%n=%d\n" justify = } ``` -------------------------------- ### Define Complex Record Structure with Multiple Output Formats Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Creates a comprehensive FFE configuration file defining multiple record types (header, employee, boss, trailer) with structure inheritance and conditional output formatting. Includes constant definitions and field-list output specification for custom formatting. ```FFE Configuration const 2dots ".." structure personel_fix { type fixed record header { id 1 H field type 1 field date 10 } record employee { id 1 E field EmpType 1 field FirstName 9 field LastName 13 field Age 2 output fixed2 } record boss { id 1 B fields-from employee output fixed2 } record trailer { id 1 T field type 1 field count 4 } } output default { data "%D" } output fixed2 { data "%D" field-list Emptype,FirstName,2dots,LastName,2dots,Age } ``` -------------------------------- ### FFE Command Substitution Syntax Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Command substitution in FFE configuration files uses backtick syntax to execute shell commands and substitute their output. The command is executed with FFE-specific environment variables set (FFE_STRUCTURE, FFE_OUTPUT, FFE_FORMAT, FFE_FIRST_FILE, FFE_FILES), and trailing newlines are automatically removed from the output. Command substitutions cannot be nested. ```bash '`command`' ``` -------------------------------- ### Execute FFE Data Anonymization Command Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Demonstrates command-line invocation of FFE anonymization. Uses -A flag for anonymization profile, -praw for raw output format, -o for output file specification, and loads default configuration from ~/.fferc. ```bash ffe -A personnel -praw -o personnel_anon.fix personnel.fix ``` -------------------------------- ### Route FFE Records to Multiple Output Files Based on Criteria Source: https://context7.com/timosavi/ffe/llms.txt This snippet showcases how to configure FFE to split input records into multiple distinct output files based on defined criteria within the structure. The FFE configuration defines two output files (engineering.csv, marketing.csv) and assigns records to them based on the 'Department' field. The subsequent bash command executes this configuration, processing employees.csv and generating the separate department-specific CSV files. ```FFE Configuration output file1 { output-file "engineering.csv" data "%t,%t,%t,%t" } output file2 { output-file "marketing.csv" data "%t,%t,%t,%t" } structure employees { type separated "," record eng_employee { id 3 "Engineering" output file1 field FirstName field LastName field Department field Salary } record mkt_employee { id 3 "Marketing" output file2 field FirstName field LastName field Department field Salary } } ``` ```bash ffe -s employees employees.csv ``` -------------------------------- ### External Lookup File Format Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Shows the semicolon-delimited format for external lookup files used with FFE. Each line contains a key and value separated by a semicolon. ```Text H;Header B;He is a Boss! E;Not a Boss! T;Trailer ``` -------------------------------- ### Extract Delimited Files with FFE Source: https://context7.com/timosavi/ffe/llms.txt This snippet demonstrates how to process comma-separated value (CSV) files using FFE. It defines a structure for 'employees' in the FFE configuration file (~/.fferc) and then uses the 'ffe' command to extract all records, showcasing automatic structure detection for delimited files. ```bash # Sample CSV input file (employees.csv) # John,Doe,Engineering,75000 # Jane,Smith,Marketing,68000 # Bob,Johnson,Sales,72000 # Configuration file (~/.fferc) structure employees { type separated "," record employee { field FirstName field LastName field Department field Salary } } output default { separator "," data "%t" } # Extract all records ffe -c ~/.fferc -s employees employees.csv # Output: # John,Doe,Engineering,75000 # Jane,Smith,Marketing,68000 # Bob,Johnson,Sales,72000 ``` -------------------------------- ### Configure FFE for XML Output Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This FFE output definition specifies how to transform parsed data into XML format. It defines the file header, data element structure, record headers and trailers, and indentation rules for generating well-formed XML. ```FFE Configuration output xml { file_header "\n" data "<%n>%t\n" record_header "<%r>\n" record_trailer "\n" indent " " } ``` -------------------------------- ### Filter FFE Records Using Expressions Source: https://context7.com/timosavi/ffe/llms.txt This section demonstrates how to filter records in FFE using expression-based comparisons on field values. It covers various operators like exact match, starts-with, contains, NOT contains, combining multiple expressions with AND, inverting matches, and filtering using values from an external file. ```bash # Filter by exact match ffe -s employees -e "Department=Engineering" employees.csv # Output: John,Doe,Engineering,75000 # Filter by starts-with ffe -s employees -e "LastName^S" employees.csv # Output: Jane,Smith,Marketing,68000 # Filter by contains ffe -s employees -e "Department~Sales" employees.csv # Output: Bob,Johnson,Sales,72000 # Filter by NOT contains ffe -s employees -e "Department#Engineering" employees.csv # Output: # Jane,Smith,Marketing,68000 # Bob,Johnson,Sales,72000 # Combine multiple expressions with AND ffe -s employees -e "Department=Engineering" -e "Salary^7" -a employees.csv # Output: John,Doe,Engineering,75000 # Invert match ffe -s employees -e "Department=Engineering" -v employees.csv # Output: # Jane,Smith,Marketing,68000 # Bob,Johnson,Sales,72000 # Filter using values from file echo "Engineering" > depts.txt echo "Sales" >> depts.txt ffe -s employees -e "Department=file:depts.txt" employees.csv # Output: # John,Doe,Engineering,75000 # Bob,Johnson,Sales,72000 ``` -------------------------------- ### Generate XML Output from Structured Data in FFE Source: https://context7.com/timosavi/ffe/llms.txt Transform delimited data into hierarchical XML format with custom headers, trailers, and element formatting. This configuration defines file-level, record-level, and element-level output structure. ```bash # Configuration for XML output output xml_format { file-header "\n" record-header " " element-header " <" data "%n>%t" record-trailer " " file-trailer "" } structure employees { type separated "," record employee { field FirstName field LastName field Department } } # Process with XML output ffe -s employees -p xml_format employees.csv # Output: # # # # John # Doe # Engineering # # # Jane # Smith # Marketing # # ``` -------------------------------- ### Configure FFE for HTML Table Output Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This FFE output definition generates an HTML table from the parsed data. It defines the necessary HTML structure including ``, ``, `
`, and `` tags, and specifies that only selected fields should be included in the table. ```FFE Configuration output html { file_header "\n\n\n\n\n\n" header "\n" record_header "\n" data "\n" file_trailer "
%n
%t
\n\n\n" no-data-print no } ``` -------------------------------- ### View FFE Anonymized Data with Nice Format Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Displays anonymized personnel data using the 'nice' output format which shows record type, structure name, filename, and field order. Demonstrates how anonymized hash values and random numbers replace original PII. ```bash ffe -pnice personnel_anon.fix ``` -------------------------------- ### View personnel data file content Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This snippet displays the raw content of the 'personnel' flat file, which contains fixed-length fields for first name, last name, and age. It serves as the input data for the `ffe` tool, demonstrating its simple, unformatted structure. ```bash cat personnel ``` ```text john Ripper 23 Scott Tiger 45 Mary Moore 41 ``` -------------------------------- ### Filter Data and Generate HTML Table with FFE Expression Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This shell command demonstrates using FFE to filter data based on an expression (`-e FirstName^Scott`) before generating an HTML table. It outputs only records where the `FirstName` field matches 'Scott', showcasing FFE's data filtering capabilities. ```Bash ffe -p html -f FirstName,LastName,Age -e FirstName^Scott personnel.fix ``` -------------------------------- ### Generate HTML Table from Fixed-Length File with FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This shell command uses FFE to process `personnel.fix` and output the data as an HTML table. It applies the 'html' output definition and explicitly selects `FirstName`, `LastName`, and `Age` fields to be included in the table. ```Bash ffe -p html -f FirstName,LastName,Age personnel.fix ``` -------------------------------- ### Load Lookup Table from External File Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Defines a lookup table that reads mapping data from an external file instead of inline pair definitions. The file format uses semicolon-delimited key-value pairs, one per line. ```FFE Configuration lookup Type { search exact file lookupdata default-value "Unknown record type!" } ``` -------------------------------- ### Define Binary File Structure in FFE Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Defines a binary structure 'bin_data' with various data types including fixed-length text, signed/unsigned integers with endianness, floating-point numbers, BCD, and hexadecimal fields. Supports platform-specific byte ordering (little-endian _le, big-endian _be). ```FFE structure bin_data { type binary record b { field text 5 field byte_int int8 field integer int32_le field number double_le field bcd_number bcd_be_3 field hex hex_be_4 } } ``` -------------------------------- ### FFE Binary Data Type Reference Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Comprehensive list of supported binary field types in FFE, including system-dependent types (char, short, int, long, llong with unsigned variants), fixed-width integers with endianness specification (int8, int16_be, int32_le, etc.), floating-point types (float, double with endianness options), and specialized formats (bcd_be_len, bcd_le_len, hex_be_len, hex_le_len for BCD and hexadecimal data). ```FFE Configuration char | short | int | long | llong | ushort | uint | ulong | ullong | int8 | int16_be | int32_be | int64_be | int16_le | int32_le | int64_le | uint8 | uint16_be | uint32_be | uint64_be | uint16_le | uint32_le | uint64_le | float | float_be | float_le | double | double_be | double_le | bcd_be_len | bcd_le_len | hex_be_len | hex_le_len ``` -------------------------------- ### Generate Nested XML from Hierarchical CSV Data - FFE Configuration Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Processes comma-separated parent-child records using FFE's level-based nesting to generate structured XML output. The configuration defines two record types (parent and child) with level specifications (1 and 2) to establish hierarchy, enabling automatic grouping of child records under their parent elements with proper XML formatting. ```FFE structure family { type separated , record parent { id 1 P field FILLER field Name field Child_count level 1 parent } record child { id 1 C field FILLER field Name field Age field FavoriteColor level 2 child children } } output nested_xml { file_header "\n" data "<%n>%t\n" indent " " record_trailer "" group_header "<%g>\n" group_trailer "\n" element_header "<%m>\n" element_trailer "\n" } ``` -------------------------------- ### Configure FFE for Human-Readable Output Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html This FFE output definition formats parsed data for human-readable display. It uses custom record headers showing source information and indents field-value pairs for clear presentation, suitable for screen output or reports. ```FFE Configuration output nice { record_header "%s - %r - %f - %o\n" data "%n=%t\n" justify = indent " " } ``` -------------------------------- ### Define Lookup Table for Field Value Translation Source: https://github.com/timosavi/ffe/blob/master/doc/ffe.html Creates a lookup table that maps single-character codes to human-readable descriptions. Supports exact search matching and provides a default value for unmapped entries. Useful for translating codes in output. ```FFE Configuration lookup Type { search exact pair H Header pair B "He is a Boss!" pair E "Not a Boss!" pair T Trailer default-value "Unknown record type!" } ```