×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi Gio
I use something like the following to replace text in place, that is, in
the original file - it uses the sed utility in QShell, which doesn't
have an option in the utility itself to do this, so I direct the results
to a temporary file and copy that back to replace the original:
export QIBM_CCSID=1208 && sed "1,5 s/fromtext/totext/" originalfile >
/tmp/tempfile.tmp && mv /tmp/tempfile.tmp originalfile
I was working with XML files, so I set the CCSID in QShell to UTF-8 -
you could leave that off, if you don't need it - the double ampersands
mean to run the next utility if there are no errors in the one before -
it is called an "and" list - each command has to be successful for the
next one to run.
The "1,5" is the range of line numbers where you will search for
"fromtext" - I believe if you leave it out, the entire file will be
searched.
This version will replace the first instance it finds - if you want all
instances replaced, put a "g" after the forward slash after "totext".
The right-arrow redirects output of sed to a temporary file.
mv command copies the temporary file back to the original.
I found this idea in a Google search a few years ago. There are other
versions of sed that have an option to replace things in the file itself
without the redirect and copy back. I didn't check the version in PASE,
so that might be better - watch out for differences in how CCSIDs are
handled between QShell and PASE.
HTH
Vern
On 1/15/2019 6:23 AM, gio.cot via RPG400-L wrote:
Hi all
I'm looking an example (possible in RPG) that replace some character with
other (that i want) inside an Ifs file
Thanks in advance
Gio
---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus
As an Amazon Associate we earn from qualifying purchases.