I think you are probably on the right track. I just finished a similar code clean project on one part of my code base. To start, I just wanted to narrow my search for each variable to the files it appeared in. The below code, for windows, outputs into a seperate text file for each variable a list of all files containing the reference. The text file is empty if no file contains the reference. It was actually quite simple from that point to review the specific files for redundancy etc from the list.
echo.
echo Building file list ...
dir K:\WorkingData /S/b/A-D | grep ".plx" - | gawk "BEGIN{ DQ = 34 }{
+if(/Copy /) ; else printf \"%%c%%s%%c\n\", DQ, $0, DQ }" >> plxlst01_
+%1.txt
dir J:\ /S/b/A-D | grep ".plx" - | gawk "{ if(/RECYCLER/) ; else print
+f \"%%c%%s%%c\n\", DQ, $0, DQ }" >> plxlst01_%1.txt
echo.
REM
REM The following command line searches (grep) each file in plxlst01_%
+1.txt for the term in parentheses and outputs the file names.
REM The resultant file names are piped to gawk to append a CRLF pair t
+o file same. This list is then sorted (sort) and duplicate
REM file names are removed (sed) and the resultant list is output to t
+he file specified. Note: For some reason, sort -u and uniq don't
REM work properly in Windows
REM
echo Searching for ChkMsgType() ...
for /F %%f IN (plxlst01_%1.txt) DO grep -l "ChkMsgType" %%f | gawk "{
+print $0 }" | J:\usr\bin\sort -u >> ChkMsgType_%1.txt
PJ
We are drowning in information and starving for knowledge - Rutherford D. Rogers
What good is knowledge if you have to pull teeth to get it - anonymous
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.