This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
linux:basics [2019/04/18 10:19] mstraub [Regular Expressions] |
linux:basics [2019/08/12 17:06] mstraub [Regular Expressions] |
||
---|---|---|---|
Line 804: | Line 804: | ||
<code bash> | <code bash> | ||
sed -E 's#(.*),(.*)#\1;\2#g' #replace a single comma with a semicolon | sed -E 's#(.*),(.*)#\1;\2#g' #replace a single comma with a semicolon | ||
+ | </code> | ||
+ | |||
+ | However, even with extended expressions ''sed'' does not support non-greedy expressions as it is possible with PCRE (perl compatible regular expressions). A good resort is to simply use ''perl'' itself: | ||
+ | |||
+ | <code bash> | ||
+ | perl -pe 's/.*thevalue="(.*?)".*/\1/g' file.txt | ||
</code> | </code> | ||