annotate sed.xml @ 0:e850a63e5aed

initial uploaded
author bjoern-gruening
date Thu, 15 Mar 2012 04:53:54 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
1 <tool id="sed_stream_editor" name="Manipulation" version="0.0.1">
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
2 <description>of text lines with regular expressions (sed)</description>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
3 <command>sed -r '$pattern' $input > $outfile</command>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
4 <inputs>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
5 <param format="txt, tabular" name="input" type="data" label="Replace lines from"/>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
6 <param name="pattern" size="40" type="text" value="" label="the pattern" help="here you can enter your sed expression (No syntax check or sanitising!)" />
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
7 </inputs>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
8 <outputs>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
9 <data format="input" name="outfile" metadata_source="input"/>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
10 </outputs>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
11 <options sanitize="False"/>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
12 <requirements>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
13 <requirement type="binary">sed</requirement>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
14 </requirements>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
15 <tests>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
16
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
17 </tests>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
18 <help>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
19
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
20 .. class:: warningmark
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
21
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
22 Use with caution! Its a plain wrapper around **sed** and the input is not sanitized.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
23
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
24
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
25 -----
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
26
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
27 **What it does**
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
28
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
29 Changes every line of a text file according to a given regular expression.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
30
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
31 -----
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
32
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
33 **Syntax**
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
34
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
35 Use the **sed**-syntax -&gt; **s/find-pattern/replace-pattern/**
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
36
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
37 **Example**
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
38
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
39 - **s/x/-/** Replace all **x** with **-**.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
40
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
41 - **s/_.*//** Splits a string after **_** and replaces the rest with nothing.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
42 - **s/[^_]*_*//** Splits a string after **_** and replaces the first part with nothing.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
43
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
44 - **s/\\s.*//** Splits a string after whitespaces and replaces the rest with nothing.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
45 - **s/\\S*\\s*//** Splits a string after whitespaces and replaces the first part with nothing.
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
46
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
47
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
48 </help>
e850a63e5aed initial uploaded
bjoern-gruening
parents:
diff changeset
49 </tool>