[3] | 1 | <tool id="cshl_cut_tool" name="cut"> |
---|
| 2 | <description>columns from files</description> |
---|
| 3 | <command interpreter="sh"> |
---|
| 4 | cut_wrapper.sh '$complement' '$cutwhat' '$list' '$input' '$output' |
---|
| 5 | </command> |
---|
| 6 | |
---|
| 7 | <inputs> |
---|
| 8 | <param format="txt" name="input" type="data" label="file to cut" /> |
---|
| 9 | |
---|
| 10 | <param name="complement" type="select" label="Operation"> |
---|
| 11 | <option value="">Keep</option> |
---|
| 12 | <option value="--complement">Discard</option> |
---|
| 13 | </param> |
---|
| 14 | |
---|
| 15 | <param name="cutwhat" type="select" label="Cut by"> |
---|
| 16 | <option value="-f">fields</option> |
---|
| 17 | <option value="-c">characters</option> |
---|
| 18 | </param> |
---|
| 19 | |
---|
| 20 | <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 = "" /> |
---|
| 21 | </inputs> |
---|
| 22 | |
---|
| 23 | <tests> |
---|
| 24 | <test> |
---|
| 25 | <param name="input" value="unix_cut_input1.txt" /> |
---|
| 26 | <output name="output" file="unix_cut_output1.txt" /> |
---|
| 27 | <param name="complement" value="Keep" /> |
---|
| 28 | <param name="cutwhat" value="fields" /> |
---|
| 29 | <param name="list" value="1,3,4" /> |
---|
| 30 | </test> |
---|
| 31 | <test> |
---|
| 32 | <param name="input" value="unix_cut_input1.txt" /> |
---|
| 33 | <output name="output" file="unix_cut_output1.txt" /> |
---|
| 34 | <param name="complement" value="Discard" /> |
---|
| 35 | <param name="cutwhat" value="fields" /> |
---|
| 36 | <param name="list" value="2" /> |
---|
| 37 | </test> |
---|
| 38 | </tests> |
---|
| 39 | |
---|
| 40 | <outputs> |
---|
| 41 | <data format="input" name="output" metadata_source="input"/> |
---|
| 42 | </outputs> |
---|
| 43 | <help> |
---|
| 44 | |
---|
| 45 | **What it does** |
---|
| 46 | |
---|
| 47 | This tool runs the **cut** unix command, which extract or delete columns from a file. |
---|
| 48 | |
---|
| 49 | ----- |
---|
| 50 | |
---|
| 51 | Field List Example: |
---|
| 52 | |
---|
| 53 | **1,3,7** - Cut specific fields/characters. |
---|
| 54 | |
---|
| 55 | **3-** - Cut from the third field/character to the end of the line. |
---|
| 56 | |
---|
| 57 | **2-5** - Cut from the second to the fifth field/character. |
---|
| 58 | |
---|
| 59 | **-8** - Cut from the first to the eight field/characters. |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | Input Example:: |
---|
| 65 | |
---|
| 66 | fruit color price weight |
---|
| 67 | apple red 1.4 0.5 |
---|
| 68 | orange orange 1.5 0.3 |
---|
| 69 | banana yellow 0.9 0.3 |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | Output Example ( **Keeping fields 1,3,4** ):: |
---|
| 73 | |
---|
| 74 | fruit price weight |
---|
| 75 | apple 1.4 0.5 |
---|
| 76 | orange 1.5 0.3 |
---|
| 77 | banana 0.9 0.3 |
---|
| 78 | |
---|
| 79 | Output Example ( **Discarding field 2** ):: |
---|
| 80 | |
---|
| 81 | fruit price weight |
---|
| 82 | apple 1.4 0.5 |
---|
| 83 | orange 1.5 0.3 |
---|
| 84 | banana 0.9 0.3 |
---|
| 85 | |
---|
| 86 | Output Example ( **Keeping 3 characters** ):: |
---|
| 87 | |
---|
| 88 | fru |
---|
| 89 | app |
---|
| 90 | ora |
---|
| 91 | ban |
---|
| 92 | |
---|
| 93 | </help> |
---|
| 94 | </tool> |
---|