Mercurial > repos > bgruening > text_processing
comparison cut.xml @ 0:ec66f9d90ef0 draft
initial uploaded
| author | bgruening |
|---|---|
| date | Thu, 05 Sep 2013 04:58:21 -0400 |
| parents | |
| children | a4ad586d1403 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:ec66f9d90ef0 |
|---|---|
| 1 <tool id="unixtools_cut_tool" name="cut" version="0.1.1"> | |
| 2 <description>columns from files</description> | |
| 3 <requirements> | |
| 4 <requirement type="package" version="8.21">gnu_coreutils</requirement> | |
| 5 </requirements> | |
| 6 <command> | |
| 7 cut ${complement} ${cutwhat} '${list}' '${input}' > '${output}' | |
| 8 </command> | |
| 9 | |
| 10 <inputs> | |
| 11 <param format="txt" name="input" type="data" label="file to cut" /> | |
| 12 <param name="complement" type="select" label="Operation"> | |
| 13 <option value="">Keep</option> | |
| 14 <option value="--complement">Discard</option> | |
| 15 </param> | |
| 16 | |
| 17 <param name="cutwhat" type="select" label="Cut by"> | |
| 18 <option value="-f">fields</option> | |
| 19 <option value="-c">characters</option> | |
| 20 <option value="-b">bytes</option> | |
| 21 </param> | |
| 22 | |
| 23 <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"> | |
| 24 <sanitizer> | |
| 25 <valid initial="string.printable"> | |
| 26 <remove value="'"/> | |
| 27 </valid> | |
| 28 </sanitizer> | |
| 29 </param> | |
| 30 </inputs> | |
| 31 | |
| 32 <tests> | |
| 33 <test> | |
| 34 <param name="input" value="unix_cut_input1.txt" /> | |
| 35 <output name="output" file="unix_cut_output1.txt" /> | |
| 36 <param name="complement" value="Keep" /> | |
| 37 <param name="cutwhat" value="fields" /> | |
| 38 <param name="list" value="1,3,4" /> | |
| 39 </test> | |
| 40 <test> | |
| 41 <param name="input" value="unix_cut_input1.txt" /> | |
| 42 <output name="output" file="unix_cut_output1.txt" /> | |
| 43 <param name="complement" value="Discard" /> | |
| 44 <param name="cutwhat" value="fields" /> | |
| 45 <param name="list" value="2" /> | |
| 46 </test> | |
| 47 </tests> | |
| 48 | |
| 49 <outputs> | |
| 50 <data format="input" name="output" metadata_source="input" /> | |
| 51 </outputs> | |
| 52 <help> | |
| 53 | |
| 54 **What it does** | |
| 55 | |
| 56 This tool runs the **cut** unix command, which extract or delete columns from a file. | |
| 57 | |
| 58 ----- | |
| 59 | |
| 60 Field List Example: | |
| 61 | |
| 62 **1,3,7** - Cut specific fields/characters. | |
| 63 | |
| 64 **3-** - Cut from the third field/character to the end of the line. | |
| 65 | |
| 66 **2-5** - Cut from the second to the fifth field/character. | |
| 67 | |
| 68 **-8** - Cut from the first to the eight field/characters. | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 Input Example:: | |
| 74 | |
| 75 fruit color price weight | |
| 76 apple red 1.4 0.5 | |
| 77 orange orange 1.5 0.3 | |
| 78 banana yellow 0.9 0.3 | |
| 79 | |
| 80 | |
| 81 Output Example ( **Keeping fields 1,3,4** ):: | |
| 82 | |
| 83 fruit price weight | |
| 84 apple 1.4 0.5 | |
| 85 orange 1.5 0.3 | |
| 86 banana 0.9 0.3 | |
| 87 | |
| 88 Output Example ( **Discarding field 2** ):: | |
| 89 | |
| 90 fruit price weight | |
| 91 apple 1.4 0.5 | |
| 92 orange 1.5 0.3 | |
| 93 banana 0.9 0.3 | |
| 94 | |
| 95 Output Example ( **Keeping 3 characters** ):: | |
| 96 | |
| 97 fru | |
| 98 app | |
| 99 ora | |
| 100 ban | |
| 101 | |
| 102 </help> | |
| 103 </tool> |
