ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

New IFSTOOL command to replace character strings in multiple stream files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • New IFSTOOL command to replace character strings in multiple stream files

    A few days ago I decided to restructure one of my sites. To do that I had to update a number of HTML tags. That could not be done through Apache configuration statements, the hard coded HTML scripts needed be changed.
    As I do not use any HTML editor, the only way I had to update the HTML pages was to use the Windows Notepad find/replace feature.
    It took me a full day to complete the work. A tedious frustrating job.
    The next day I promised myself that I would never do that again in my life.
    I needed a tool to carry out similar duties in a few seconds. As no such tool was available on IBMi, I decided to build one.

    Here it comes. I just added a new command to library IFSTOOL, it's command REPLACE. It allows to replace characters strings in all the stream files within a given IFS directory and sub-directories, if you like to.
    You can even monitor each change and decide whether it should take place.
    Read about it at page http://www.easy400.net/ifstool/html/ifstool.htm#C4 .

    IFSTOOL is an open-source utility that you download from site http://www.easy400.net . You can get it free is that is your first download.
    The initial version of IFSTOOL was made available in year 2003 for listing the contents of an IFS directory. New features have been added since then:
    - command CHKIFSOBJ, check an IFS object
    - command MONIFS, monitor IFS events
    - command WRKIFSREF, list the jobs currently referencing a given IFS object
    - command SEARCH, search IFS directory for stream files containing a given character string
    and last today
    - command REPLACE, replace a given character string in all stream files within an IFS directory.

    Giovanni B. Perotti
    IFSTOOL author

  • #2
    Re: New IFSTOOL command to replace character strings in multiple stream files

    An alternative is to use "sed" in conjunction with "find" in QSHell.

    I was faced with a similar problem a couple of weeks ago, but needed a Windows based solution. I downloaded gnuwin32 from the free software foundation's to get find and sed, then after a bit of tweaking, (I remember renaming "find" to "gfind" to avoid a conflict with the Windows find command) was able to get it done. You can do the same thing in QShell, although the syntax is a little different. The command that did the trick for me to change all tilde's (~) to line feeds on Windows was:
    c:\GnuWin32\bin\gfind v:/testin -type f | xargs -exec sed -i -e s/~/\n/g

    Comment

    Working...
    X