Mercurial > repos > bgruening > text_processing
diff cut.xml @ 0:ec66f9d90ef0 draft
initial uploaded
author | bgruening |
---|---|
date | Thu, 05 Sep 2013 04:58:21 -0400 |
parents | |
children | a4ad586d1403 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cut.xml Thu Sep 05 04:58:21 2013 -0400 @@ -0,0 +1,103 @@ +<tool id="unixtools_cut_tool" name="cut" version="0.1.1"> + <description>columns from files</description> + <requirements> + <requirement type="package" version="8.21">gnu_coreutils</requirement> + </requirements> + <command> + cut ${complement} ${cutwhat} '${list}' '${input}' > '${output}' + </command> + + <inputs> + <param format="txt" name="input" type="data" label="file to cut" /> + <param name="complement" type="select" label="Operation"> + <option value="">Keep</option> + <option value="--complement">Discard</option> + </param> + + <param name="cutwhat" type="select" label="Cut by"> + <option value="-f">fields</option> + <option value="-c">characters</option> + <option value="-b">bytes</option> + </param> + + <param name="list" type="text" size="20" value="" label="List of Fields/Characters/Bytes" help="These will be kept/discarded (depending on 'operation'). <BR /> Examples: 1,3,4 or 2-5"> + <sanitizer> + <valid initial="string.printable"> + <remove value="'"/> + </valid> + </sanitizer> + </param> + </inputs> + + <tests> + <test> + <param name="input" value="unix_cut_input1.txt" /> + <output name="output" file="unix_cut_output1.txt" /> + <param name="complement" value="Keep" /> + <param name="cutwhat" value="fields" /> + <param name="list" value="1,3,4" /> + </test> + <test> + <param name="input" value="unix_cut_input1.txt" /> + <output name="output" file="unix_cut_output1.txt" /> + <param name="complement" value="Discard" /> + <param name="cutwhat" value="fields" /> + <param name="list" value="2" /> + </test> + </tests> + + <outputs> + <data format="input" name="output" metadata_source="input" /> + </outputs> + <help> + +**What it does** + +This tool runs the **cut** unix command, which extract or delete columns from a file. + +----- + +Field List Example: + +**1,3,7** - Cut specific fields/characters. + +**3-** - Cut from the third field/character to the end of the line. + +**2-5** - Cut from the second to the fifth field/character. + +**-8** - Cut from the first to the eight field/characters. + + + + +Input Example:: + + fruit color price weight + apple red 1.4 0.5 + orange orange 1.5 0.3 + banana yellow 0.9 0.3 + + +Output Example ( **Keeping fields 1,3,4** ):: + + fruit price weight + apple 1.4 0.5 + orange 1.5 0.3 + banana 0.9 0.3 + +Output Example ( **Discarding field 2** ):: + + fruit price weight + apple 1.4 0.5 + orange 1.5 0.3 + banana 0.9 0.3 + +Output Example ( **Keeping 3 characters** ):: + + fru + app + ora + ban + + </help> +</tool>