Mercurial > repos > xuebing > sharplabtool
diff tools/unix_tools/cut_tool.xml @ 0:9071e359b9a3
Uploaded
author | xuebing |
---|---|
date | Fri, 09 Mar 2012 19:37:19 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/unix_tools/cut_tool.xml Fri Mar 09 19:37:19 2012 -0500 @@ -0,0 +1,94 @@ +<tool id="cshl_cut_tool" name="cut"> + <description>columns from files</description> + <command interpreter="sh"> + cut_wrapper.sh '$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> + </param> + + <param name="list" type="text" size="20" label="List of Fields/Characters/Bytes" help="These will be kept/discarded (depending on 'operation'). <BR /> Examples: 1,3,4 or 2-5" value = "" /> + </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>