view cut.xml @ 0:631dfde45073 draft default tip

First tool-shed public version
author gordon
date Tue, 09 Oct 2012 18:48:06 -0400
parents
children
line wrap: on
line source

<tool id="cshl_cut_tool" name="cut" version="0.1.1">
  <description>columns from files</description>
  <command>
	cut $complement $cutwhat '$list' '$input1' &gt; '$output'
  </command>

  <inputs>
	<param format="txt" name="input1" 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" label="List of Fields/Characters/Bytes" help="These will be kept/discarded (depending on 'operation'). &lt;BR /&gt; Examples: 1,3,4 or 2-5" value = "">
		<sanitizer>
		    <valid initial="string.printable">
			    <remove value="&apos;"/>
		    </valid>
	    </sanitizer>
	</param>
  </inputs>

  <outputs>
    <data format="input" name="output" metadata_source="input1"
	/>
  </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>