manpagez: man pages & more
info ffe
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2 Samples using ffe

One example of using ffe for printing personnel information in XML format from fixed length flat file:

$ cat personnel
john     Ripper       23
Scott    Tiger        45
Mary     Moore        41
$

A file ‘personnel’ contains three fixed length fields: ‘FirstName’, ‘LastName’ and ‘Age’, their respective lengths are 9,13 and 2.

In order to print data above in XML, following configuration file must be available:

$cat personnel.fferc
structure personel {
    type fixed
    output xml
    record person {
        field FirstName 9
        field LastName  13
        field Age 2
    }
}

output xml {
    file_header "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
    data "<%n>%t</%n>\n"
    record_header "<%r>\n"
    record_trailer "</%r>\n"
    indent " "
}
$

Using ffe:

$ffe -c personnel.fferc personnel
<?xml version="1.0" encoding="ISO-8859-1"?>
 <person>
  <FirstName>john</FirstName>
  <LastName>Ripper</LastName>
  <Age>23</Age>
 </person>
 <person>
  <FirstName>Scott</FirstName>
  <LastName>Tiger</LastName>
  <Age>45</Age>
 </person>
 <person>
  <FirstName>Mary</FirstName>
  <LastName>Moore</LastName>
  <Age>41</Age>
 </person>
$

This document was generated on March 30, 2014 using texi2html 5.0.

© manpagez.com 2000-2017
Individual documents may contain additional copyright information.