|
Ah, nice to know - you inspired me to search for "sed greegy" and it seems that sed IS greedy - so that people can use something, for example, like [^/]*to get everything up to the next forward slash - an example I saw used this when parsing a URL.
On 9/2/2014 2:50 PM, John Yeung wrote:
On Tue, Sep 2, 2014 at 12:28 PM, Vernon Hamberg
<vhamberg@xxxxxxxxxxxxxxx> wrote:
Here is an example using the qsh command -Your understanding of what it does is correct, but 'g' here means
qsh cmd('export QIBM_CCSID=1208 && sed "firstlinetosearh,lastlinetosearch
s/searchstring/replacestring/g" ifsfilepath > temp.tmp && mv temp.tmp
ifsfilepath')
The "g" right after "replacestring/" means greedy, IIRC - it makes sed
replace every instance of the search string.
"global". The term "greedy" does apply to regular expressions, but in
the context of matching within a pattern. If you have the pattern
<td>.*</td>
for example, "greedy" means the .* will match as many characters as
possible. If your data is
<tr><td>4</td><td>5</td></tr>
then this pattern will match everything between the '<tr>' and the
'</tr>'. Most regex processors are greedy by default.
John Y.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.