Mercurial > repos > bgruening > text_processing
annotate replace_text_in_line.xml @ 27:08cdbfffce67 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
author | bgruening |
---|---|
date | Fri, 07 Mar 2025 20:43:41 +0000 |
parents | f22a309187a3 |
children |
rev | line source |
---|---|
26
f22a309187a3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit c2b1677d1c94433f777c2dc28ac8eec0a99cc6a7
bgruening
parents:
19
diff
changeset
|
1 <tool id="tp_replace_in_line" name="Replace Text" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
3 | 2 <description>in entire line</description> |
4 | 3 <macros> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
4 <import>macros.xml</import> |
4 | 5 </macros> |
26
f22a309187a3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit c2b1677d1c94433f777c2dc28ac8eec0a99cc6a7
bgruening
parents:
19
diff
changeset
|
6 <expand macro="creator"/> |
13
3c685c4106b3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents:
12
diff
changeset
|
7 <requirements> |
26
f22a309187a3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit c2b1677d1c94433f777c2dc28ac8eec0a99cc6a7
bgruening
parents:
19
diff
changeset
|
8 <requirement type="package" version="4.8">sed</requirement> |
13
3c685c4106b3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b9d202134c3c6d0e5c398c3ae75e410067fcfc52
bgruening
parents:
12
diff
changeset
|
9 </requirements> |
4 | 10 <version_command>sed --version | head -n 1</version_command> |
6 | 11 <command> |
4 | 12 <![CDATA[ |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
13 sed |
18
1e974b82380d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 0ba37c1f33eeb1c77b4d9363d681fe522d9f7fe7
bgruening
parents:
17
diff
changeset
|
14 -r |
1e974b82380d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 0ba37c1f33eeb1c77b4d9363d681fe522d9f7fe7
bgruening
parents:
17
diff
changeset
|
15 --sandbox |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
16 #for $replacement in $replacements: |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
17 -e '$replacement.sed_options' |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
18 -e |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
19 's/$replacement.find_pattern/$replacement.replace_pattern/g' |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
20 #end for |
18
1e974b82380d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 0ba37c1f33eeb1c77b4d9363d681fe522d9f7fe7
bgruening
parents:
17
diff
changeset
|
21 '$infile' |
1e974b82380d
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 0ba37c1f33eeb1c77b4d9363d681fe522d9f7fe7
bgruening
parents:
17
diff
changeset
|
22 > '$outfile' |
4 | 23 ]]> |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
24 |
3 | 25 </command> |
26 <inputs> | |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
27 <param format="txt" name="infile" type="data" label="File to process" /> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
28 <repeat name="replacements" title="Replacement" min="1"> |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
29 <param name="find_pattern" type="text" size="20" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " > |
3 | 30 <sanitizer> |
31 <valid initial="string.printable"> | |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
32 <remove value="'"/> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
33 <remove value="/"/> |
3 | 34 </valid> |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
35 <mapping initial="none"> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
36 <add source="'" target="'"'"'" /> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
37 <add source="/" target="\/"/> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
38 </mapping> |
3 | 39 </sanitizer> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
40 </param> |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
41 <param name="replace_pattern" type="text" size="20" label="Replace with:" help="Use simple text, or & (ampersand) and \\1 \\2 \\3 to refer to matched text. See examples below." > |
3 | 42 <sanitizer> |
43 <valid initial="string.printable"> | |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
44 <remove value="'"/> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
45 <remove value="/"/> |
3 | 46 </valid> |
17
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
47 <mapping initial="none"> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
48 <add source="'" target="'"'"'" /> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
49 <add source="/" target="\/"/> |
f2918761eaf3
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit f48156f03164bde1f1be4826b2f0a1f16dc2cd2f
bgruening
parents:
16
diff
changeset
|
50 </mapping> |
3 | 51 </sanitizer> |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
52 </param> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
53 <param name="sed_options" type="text" size="20" optional="true" label="Additional sed commands before replacement" help="Provide additional sed commands before the replacement (e.g., ':a;N;$!ba;')." > |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
54 <sanitizer> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
55 <valid initial="string.printable"> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
56 <remove value="'"/> <!-- Removes single quotes --> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
57 <remove value="/"/> <!-- Removes slashes --> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
58 </valid> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
59 <mapping initial="none"> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
60 <add source="'" target="'"'"'" /> <!-- Escapes single quotes --> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
61 <add source="/" target="\/"/> <!-- Escapes slashes --> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
62 </mapping> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
63 </sanitizer> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
64 </param> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
65 </repeat> |
3 | 66 </inputs> |
67 <outputs> | |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
68 <data name="outfile" format_source="infile" metadata_source="infile"/> |
3 | 69 </outputs> |
4 | 70 <tests> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
71 <test> |
6 | 72 <param name="infile" value="replace_text_in_line1.txt" /> |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
73 <repeat name="replacements"> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
74 <param name="find_pattern" value="CTC." /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
75 <param name="replace_pattern" value="FOOBAR" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
76 <param name="sed_options" value="" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
77 </repeat> |
6 | 78 <output name="outfile" file="replace_text_in_line_results1.txt" /> |
4 | 79 </test> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
80 <test> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
81 <param name="infile" value="replace_text_in_line1.txt" /> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
82 <repeat name="replacements"> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
83 <param name="find_pattern" value="CTC." /> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
84 <param name="replace_pattern" value="FOOBAR" /> |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
85 <param name="sed_options" value="" /> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
86 </repeat> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
87 <repeat name="replacements"> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
88 <param name="find_pattern" value="chr" /> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
89 <param name="replace_pattern" value="domain" /> |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
90 <param name="sed_options" value="" /> |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
91 </repeat> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
92 <output name="outfile" file="replace_text_in_line_results2.txt" /> |
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
93 </test> |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
94 <test> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
95 <param name="infile" value="replace_text_in_line1.txt" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
96 <repeat name="replacements"> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
97 <param name="find_pattern" value="\n" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
98 <param name="replace_pattern" value="" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
99 <param name="sed_options" value=":a;N;$!ba" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
100 </repeat> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
101 <output name="outfile" file="replace_text_in_line_results3.txt" /> |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
102 </test> |
4 | 103 </tests> |
3 | 104 <help> |
4 | 105 <![CDATA[ |
3 | 106 **What it does** |
107 | |
6 | 108 This tool performs find & replace operation on a specified file. |
3 | 109 |
110 .. class:: infomark | |
111 | |
112 The **pattern to find** uses the **extended regular** expression syntax (same as running 'sed -r'). | |
113 | |
114 .. class:: infomark | |
115 | |
116 **TIP:** If you need more complex patterns, use the *sed* tool. | |
117 | |
118 ----- | |
119 | |
120 **Examples of Find Patterns** | |
121 | |
122 - **HELLO** The word 'HELLO' (case sensitive). | |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
123 - **AG.T** The letters A,G followed by any single character, followed by the letter T. |
3 | 124 - **A{4,}** Four or more consecutive A's. |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
125 - **chr2[012]\\t** The words 'chr20' or 'chr21' or 'chr22' followed by a tab character. |
3 | 126 - **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. |
127 | |
128 | |
129 **Examples of Replace Patterns** | |
130 | |
131 - **WORLD** The word 'WORLD' will be placed whereever the find pattern was found. | |
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
13
diff
changeset
|
132 - **FOO-&-BAR** Each time the find pattern is found, it will be surrounded with 'FOO-' at the beginning and '-BAR' at the end. **&** (ampersand) represents the matched find pattern. |
3 | 133 - **\\1** The text which matched the first parenthesis in the Find Pattern. |
134 | |
135 | |
136 ----- | |
137 | |
138 **Example 1** | |
139 | |
140 **Find Pattern:** HELLO | |
141 **Replace Pattern:** WORLD | |
142 | |
143 Every time the word HELLO is found, it will be replaced with the word WORLD. | |
144 | |
145 | |
146 ----- | |
147 | |
148 **Example 2** | |
149 | |
7 | 150 **Find Pattern:** ^(.{4}) |
6 | 151 **Replace Pattern:** &\\t |
3 | 152 |
153 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. | |
154 | |
155 | |
156 ----- | |
157 | |
19
bed2226b90f7
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 29899be24c03f631ef3be107fd60e9f898806321
bgruening
parents:
18
diff
changeset
|
158 **Extended Regular Expression Syntax** |
3 | 159 |
7 | 160 The select tool searches the data for lines containing or not containing a match to the given pattern. A Regular Expression is a pattern descibing a certain amount of text. |
3 | 161 |
162 - **( ) { } [ ] . * ? + \ ^ $** are all special characters. **\\** can be used to "escape" a special character, allowing that special character to be searched for. | |
163 - **^** matches the beginning of a string(but not an internal line). | |
164 - **(** .. **)** groups a particular pattern. | |
165 - **{** n or n, or n,m **}** specifies an expected number of repetitions of the preceding pattern. | |
166 | |
167 - **{n}** The preceding item is matched exactly n times. | |
7 | 168 - **{n,}** The preceding item ismatched n or more times. |
169 - **{n,m}** The preceding item is matched at least n times but not more than m times. | |
3 | 170 |
171 - **[** ... **]** creates a character class. Within the brackets, single characters can be placed. A dash (-) may be used to indicate a range such as **a-z**. | |
172 - **.** Matches any single character except a newline. | |
173 - ***** The preceding item will be matched zero or more times. | |
174 - **?** The preceding item is optional and matched at most once. | |
175 - **+** The preceding item will be matched one or more times. | |
176 - **^** has two meaning: | |
7 | 177 - matches the beginning of a line or string. |
3 | 178 - indicates negation in a character class. For example, [^...] matches every character except the ones inside brackets. |
179 - **$** matches the end of a line or string. | |
7 | 180 - **\|** Separates alternate possibilities. |
3 | 181 |
182 | |
27
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
183 **Note**: SED uses extended regular expression syntax, not Perl syntax. **\\d**, **\\w**, **\\s** etc. are **not** supported. However, you can use SED FAQ to perform commands using special characters. |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
184 More complex options can look like `sed -e '$!N;s/foo/bar/;'`. Here, `$!N;` is an optional part which you only need to set in very special cases. The `foo` part is the search string, and the `bar` part is the replacement string. |
08cdbfffce67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 2dc2df988bd2dde9f8d7f629b594186dbd4fdc2b
bgruening
parents:
26
diff
changeset
|
185 Please read the SED FAQ here: https://www.pement.org/sed/sedfaq3.html#s3.2 |
3 | 186 |
4 | 187 ]]> |
3 | 188 </help> |
14
7725ab6dab67
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
bgruening
parents:
13
diff
changeset
|
189 <expand macro="citations" /> |
3 | 190 </tool> |