helpful procedure to SEARCH prc tables
Richard D. Williams
richard at appgrp.net
Fri Dec 8 13:03:13 PST 2017
Mark,
That sounds fantastic. Would like to share it?
Richard
On 12/8/2017 2:59 PM, Fairlight via Filepro-list wrote:
> Unless you want to match on regex, in which case use egrep.
>
> I went one better: I wrote a global search-and-replace program. :)
>
> m->
>
> On Fri, Dec 08, 2017 at 03:17:53PM -0500, Brian K. White via Filepro-list thus spoke:
>> #!/bin/sh
>> read -p "What FilePro file (blank for all): " y
>> cd /u/global/appl/filepro/"$y"
>> read -p "Enter what you are looking for: " x
>> find ./ -name 'prc.*' -print0 |xargs -0 grep -ni "$x" |less -np "$x"
>>
>>
>>
>> On 12/8/2017 1:57 PM, Richard D. Williams via Filepro-list wrote:
>>> Here's a helpful program to search ascii prc tables for a text match.
>>>
>>> /usr/local/bin/SEARCH_IT
>>>
>>> rm -f /tmp/$USER.txt
>>> for file in `ls -1 $1`; do if grep -q "$2" "$file"; then echo
>>> $file >> /tmp/$USER.txt; cat $file | grep -n "$2" >>
>>> /tmp/$USER.txt; echo "" >> /tmp/$USER.txt; fi; done;
>>> vi /tmp/$USER.txt
>>>
>>> (note make this the "for file" line has no carriage returns. the
>>> email wraps it.)
>>>
>>> This is hwo you use it;
>>> # cd /appl/filepro/yourfile
>>> # SEARCH_IT "prc.*" "lookup prt ="
>>> or
>>> # SEARCH_IT "prc.*" "\"MY TEXT IN QUOTES\""
>>>
>>> It does require all prc tables be in ascii format and that your
>>> login name is set
>>>
>>> To see which tables are not is ascii format;
>>>
>>> 1) cd /appl/filepro/your_file
>>> 2) ls -1 prc.* > /tmp/PRC.txt
>>> 3) create this in a sample/prc.input. I use r_process/prc.input;
>>>
>>> end::end:
>>> @keyR::PUTENV "PFADDWP","OFF":
>>> ::debug on:
>>> ::fa="/tmp/PRC.txt":
>>> lokfile::import ascii mgr = (fa) r=\n f=\r:
>>> :not mgr:end:
>>> ::z=""{mgr(1):
>>> ::fb="/appl/filepro/your_file/"{z:
>>> ::import ascii rdw = (fb) r=\n f=\r:
>>> ::l=""{rdw(1){"";close rdw:
>>> :l eq "":goto lokfile:
>>> ::n(4,.0)=DLEN(l):
>>> :mid(l,"1","1") eq "" and mid(l,n,"1") eq "":goto lokfile:
>>> ::fc="/tmp/BADPRC.txt":
>>> :'strip off the prc.:mid(z,"1","4")="";z=""{z:
>>> ::export ascii bad = (fc) r=\n f=\r:
>>> ::bad(1)=""{z:
>>> ::goto lokfile:
>>>
>>> Now you have identified the files that need to be recompiled with
>>> ABE=ASCII set.
>>> Since we have removed the prc. when writing the /tmp/BADPRC.txt,
>>> we can run this script;
>>>
>>> # for file in `cat /tmp/BADPRC.txt`; do /appl/fp/rcabe yourfile
>>> $file; done;
>>>
>>> Once you run through these prc. file by recording them, all your
>>> prc. tables are searchable.
>>>
>>> Hope this helps somebody,
>>>
>>> Richard D. Williams
>>>
>>> BTW: I have found that this, /appl/fp/rcabe sample -ca, does not
>>> recompile the prc tables into ASCII text.
>>>
>>>
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20171208/e7db1e59/attachment.html>
>>>
>>> _______________________________________________
>>> Filepro-list mailing list
>>> Filepro-list at lists.celestial.com
>>> Subscribe/Unsubscribe/Subscription Changes
>>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>>
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
More information about the Filepro-list
mailing list