Processor Command Line Interface Code
Processor Command Line Interface Code intends to transform files in the configuration using Bash script. Bash is a command-line interface for interacting with the operating system. Bash shell script allows you to run an entire script of commands, which might contain a single simple command, list of commands, or even functions, loops, and other control flow tools.
Requirements
Fundamental knowledge of programming concepts and some experience with Bash scripting language.
Learn more: GNU Coreutils manual, Shell Scripting Tutorial
Features
Distribution: Debian Jessie
Available Utilities:
- Complete BASH with standard Unix utilities.
- jq
- Additional utilities can be installed on request.
Limitations:
- 2 GB RAM
- 1 vCPU
- 3 hours of execution
Data In/ Data Out
Data In |
Files for processing and transformation can be located in |
Data Out |
Files should be moved to /data/out/tables or /data/out/files depending on the need of the next component. |
Learn more: about the folder structure please go to this article.
Code Editor, Script
This field is intended for the Bash script that you write for processing the file.
Learn more: how to search & replace within a code editor.
Script location and paths
|
The script file
Data Out
|
Standard output |
The analog of the console log in Meiro Integrations is the activity log. If you run
Example 1: moving and renaming files By default, CSV files are saved by connectors and processors in the
Example 2: downloading a file into the required folder This example demonstrates how to download a file using the URL link. Data out folder: /data/out/tables/titanic_data.csv
Example 3: creating headers for a table Sometimes the data you receive does not have any headers which make it inconvenient for future transformations. This example demonstrates how to create a new file with the headers for the table and join it with the table you have. For the purposes of this demonstration, we create the example file ourselves using the script.
for num in 1 2 3 4 5 do echo $num, $((num*2)) >> out/files/numbers.csv done
|
Reproducing and debugging |
If you want to reproduce running the code on your computer for testing and debugging, or you want to write the script in a local IDE and copy-paste it in Meiro Integrations configuration, the easiest way to do this will be to reproduce the structure of folders as follows:
The script file should be located in the |
Tutorials:
How to create a header in your file using Command Line Interface Code processor,
No Comments