
| Current Path : /var/www/web-klick.de/dsh/90_akt/adr/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/web-klick.de/dsh/90_akt/adr/howto.txt |
2. Address Files ---------------- Addresses areb stored in address files in the following formats: - xls - xlsx - csv 2.1. Structure of an address file ---------------------------------- Leading lines which contain dots or are empty, will be skipped. The first line after that skipped leading lines contains the column names, for example: NAME,VORNAME,STRASSE,PLZ,STADT,TEL,MAIL,SEX The following lines are the data sets. Field entries can contain carriage returns if they are included in "...". 2.2. Free entries ------------------ Field entries can contain their own field descriptor, for example: "INFO: Customer_AutoTest". In this case the field descriptor from the first line (line of column names) is overwritten. Entries in this form are called 'free entries'. Newlines and spaces before the field descriptor will be omitted. Therefore, in the case of a csv file, it is possible to store the data as like as in the following example: Mustermann,Max,Teststrasse 5,90403,Nuernberg,09111/77777,max.mustermann@online.de,m xy2," FAX: 0911/67854"," INDEX: CeBIT2013"," SEX: m cg8"," " 2.3. Editing address files --------------------------- a) Address files in form of xls- or xlsx-files can be edited with Excel, OpenOffice or LibreOffice. b) Address files in form of an csv file can be editied with notepad, joe or another editor, or CSVED. c) CSV-files also can be edited with Excel, OpenOffice or LibreOffice. If you do so, store the manipulated Address file as xls/xlsx-file and DELETE the originary csv-file. The transformation of an xls/xlsx-File to a csv-file can be done with the address script adr (see above, section 'Merging'). 3. The address script adr -------------------------- With the script adr it is possible to re-sort, filter and merge address files. Furthermore, templates can be used and files can be created based on that templates. 3.1. Installation of the script -------------------------------- 3.2. General syntax -------------------- The script adr takes up to five arguments: 1. a comma-, space- resp. newline-separated list of adr-files 2. a filter expression, see below 3. a template (optional, default value: . ), see below 4. a sort order (optional, default value: -OBJ- ), see below 5. a filter template (optional, default value: -OBJ- ), see below The script prints out the template for each matching entry. If the list of address-files is - or -- , then the STDIN is read in. Hence, it is possible to concatenate commands on the command line as like as: ls * | grep -P '2013.*csv' | adr - <param1> <param2> ... In this example all address csv-files which contain the string 2013 in their names will be read in. If the list identifier has a leading '-', then the free entries will start directly with the field identifier, otherwise they start with a leading newline. 3.3 The template ----------------- In the template all strings of the form -([A-Z0-9_]+)- are PLACEHOLDERS. Placeholders will be replaced by the respective field content. For example: -NAME- will be replaced by Mustermann. A special template is: .. This template is identical with the first line of fixed field columns. In the above example, the template .. is: -NAME-,-VORNAME-,-STRASSE-,-PLZ-,-STADT-,-TEL-,-MAIL-,-SEX- Another template (the default template) is: . It is similar to .. , but the formal 'field descriptor' -REST- is added: -NAME-,-VORNAME-,-STRASSE-,-PLZ-,-STADT-,-TEL-,-MAIL-,-SEX-,-REST- and all remaining fields will be appended as free fields. Note that the result of that both templates can be put into a csv-file, which can be used as a address-file again. 3.4 File templates ------------------- If the given template is a file, then the outprint will be appended to a file where in the file name of the template AND in its content the placeholders will be replaced. (If a template filename starts with a placeholder, you can omit the leading '-' .) The 'placeholders' TIME1, TIME2 and TIME3 replace to the actual time, in several certain formats. Example: A template file with the name: TIME1.-VORNAME-_-NAME-_Information.txt and content: This is a test content for -VORNAME- in -STADT-. replaces to the file: 1312.Max_Mustermann_Information.txt with the content: This is a test content for Max in Nuernberg. 3.5. Filtering --------------- Entries from the given adr-files will be skipped if and only if the filter expression does not match the filter template after replacing its placeholders. The filter is a concatenation of text patterns by ~ and , ~ means OR, , means AND 4.5. Sorting ------------- The order of the outprint can be ruled by the 4th parameter which is a template. The entries are sorted in alphabetical order of that sorting template after replacing tis placeholders. 3.6 Merging ------------- Entries which replace to the same sorting expression will be treated as the same person, and the fields will be merged.