Mercurial > repos > bgruening > text_processing
diff replace_text_in_line.xml @ 6:8928e6d1e7ba draft
Uploaded
author | bgruening |
---|---|
date | Thu, 08 Jan 2015 09:07:31 -0500 |
parents | 56e80527c482 |
children | d64eace4f9f3 |
line wrap: on
line diff
--- a/replace_text_in_line.xml Wed Jan 07 11:15:41 2015 -0500 +++ b/replace_text_in_line.xml Thu Jan 08 09:07:31 2015 -0500 @@ -7,18 +7,18 @@ <requirement type="package" version="4.2.2-sandbox">gnu_sed</requirement> </expand> <version_command>sed --version | head -n 1</version_command> - <command interpreter="sh"> + <command> <![CDATA[ sed -r --sandbox "s/$find_pattern/$replace_pattern/g" - "$input" - > "$output" + "$infile" + > "$outfile" ]]> </command> <inputs> - <param format="txt" name="input" type="data" label="File to process" /> + <param format="txt" name="infile" type="data" label="File to process" /> <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > <sanitizer> <valid initial="string.printable"> @@ -35,21 +35,21 @@ </param> </inputs> <outputs> - <data format="input" name="output" metadata_source="input"/> + <data name="outfile" format_source="infile" metadata_source="infile"/> </outputs> <tests> <test> - <param name="input" value="replace_text_in_line_in1.txt" /> + <param name="infile" value="replace_text_in_line1.txt" /> <param name="find_pattern" value="CTC." /> <param name="replace_pattern" value="FOOBAR" /> - <output name="output" file="replace_text_in_line_output1.txt" /> + <output name="outfile" file="replace_text_in_line_results1.txt" /> </test> </tests> <help> <![CDATA[ **What it does** -This tool performs find & replace operation on a specified file. +This tool performs find & replace operation on a specified file. .. class:: infomark @@ -61,7 +61,6 @@ ----- - **Examples of Find Patterns** - **HELLO** The word 'HELLO' (case sensitive). @@ -71,16 +70,13 @@ - **hsa-mir-([^ ]+)** The text 'hsa-mir-' followed by one-or-more non-space characters. When using parenthesis, the matched content of the parenthesis can be accessed with **\1** in the **replace** pattern. - **Examples of Replace Patterns** - **WORLD** The word 'WORLD' will be placed whereever the find pattern was found. -- **FOO-&-BAR** Each time the find pattern is found, it will be surrounded with 'FOO-' at the begining and '-BAR' at the end. **&** (ampersand) represents the matched find pattern. +- **FOO-&-BAR** Each time the find pattern is found, it will be surrounded with 'FOO-' at the begining and '-BAR' at the end. **$** (ampersand) represents the matched find pattern. - **\\1** The text which matched the first parenthesis in the Find Pattern. - - ----- **Example 1** @@ -96,7 +92,7 @@ **Example 2** **Find Pattern:** ^(.{4}) -**Replace Pattern:** &\\t +**Replace Pattern:** &\\t Find the first four characters in each line, and replace them with the same text, followed by a tab character. In practice - this will split the first line into two columns.