0
|
1 <tool id="sed_stream_editor" name="Manipulation" version="0.0.1">
|
|
2 <description>of text lines with regular expressions (sed)</description>
|
|
3 <command>sed -r '$pattern' $input > $outfile</command>
|
|
4 <inputs>
|
|
5 <param format="txt, tabular" name="input" type="data" label="Replace lines from"/>
|
|
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!)" />
|
|
7 </inputs>
|
|
8 <outputs>
|
|
9 <data format="input" name="outfile" metadata_source="input"/>
|
|
10 </outputs>
|
|
11 <options sanitize="False"/>
|
|
12 <requirements>
|
|
13 <requirement type="binary">sed</requirement>
|
|
14 </requirements>
|
|
15 <tests>
|
|
16
|
|
17 </tests>
|
|
18 <help>
|
|
19
|
|
20 .. class:: warningmark
|
|
21
|
|
22 Use with caution! Its a plain wrapper around **sed** and the input is not sanitized.
|
|
23
|
|
24
|
|
25 -----
|
|
26
|
|
27 **What it does**
|
|
28
|
|
29 Changes every line of a text file according to a given regular expression.
|
|
30
|
|
31 -----
|
|
32
|
|
33 **Syntax**
|
|
34
|
|
35 Use the **sed**-syntax -> **s/find-pattern/replace-pattern/**
|
|
36
|
|
37 **Example**
|
|
38
|
|
39 - **s/x/-/** Replace all **x** with **-**.
|
|
40
|
|
41 - **s/_.*//** Splits a string after **_** and replaces the rest with nothing.
|
|
42 - **s/[^_]*_*//** Splits a string after **_** and replaces the first part with nothing.
|
|
43
|
|
44 - **s/\\s.*//** Splits a string after whitespaces and replaces the rest with nothing.
|
|
45 - **s/\\S*\\s*//** Splits a string after whitespaces and replaces the first part with nothing.
|
|
46
|
|
47
|
|
48 </help>
|
|
49 </tool>
|