using QSH and the grep command to search for sensitive data strings - IBM AS400

This is a discussion on using QSH and the grep command to search for sensitive data strings - IBM AS400 ; Hello, I've heard good things about using grep to search for strings across files in the filesystem; I've also seen where you could use this on physical files and members; however, when I tried to get this to work, using: ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: using QSH and the grep command to search for sensitive data strings

  1. using QSH and the grep command to search for sensitive data strings

    Hello,

    I've heard good things about using grep to search for strings across
    files in the filesystem; I've also seen where you could use this on
    physical files and members; however, when I tried to get this to work,
    using:


    grep 'XXXX$' /QSYS.LIB/QGPL.LIB/USRLST.FILE/*

    I got the following message

    grep: 001-0023 Error found opening file /QSYS.LIB/QGPL.LIB/
    USRLST.FILE/USRLST.MBR. Operation not supported.

    I've seen a few things on google showing people have been successful
    doing this, so I'm at a loss as to why it doesn't work for me...is
    there something i'm missing? Not really a lot of documentation to go
    on, could anybody offer some assistence to get this to work correctly?

    Thanks,

    Chris

  2. Re: using QSH and the grep command to search for sensitive datastrings

    On Oct 1, 8:32*pm, Chris wrote:
    > Hello,
    >
    > I've heard good things about using grep to search for strings across
    > files in the filesystem; I've also seen where you could use this on
    > physical files and members; however, when I tried to get this to work,
    > using:
    >
    > grep 'XXXX$' /QSYS.LIB/QGPL.LIB/USRLST.FILE/*
    >
    > I got the following message
    >
    > * *grep: 001-0023 Error found opening file /QSYS.LIB/QGPL.LIB/
    > USRLST.FILE/USRLST.MBR. Operation not supported.
    >
    > I've seen a few things on google showing people have been successful
    > doing this, so I'm at a loss as to why it doesn't work for me...is
    > there something i'm missing? *Not really a lot of documentation to go
    > on, could anybody offer some assistence to get this to work correctly?
    >
    > Thanks,
    >
    > Chris


    I had the same result. I also found I can only cat a db file member if
    I used -c which dumps everything into one output line. I thought it
    was due to packed decimal but no. It does work OK with sourcepf but
    otherwise you will have to either cpytoimpf of cpytostmf then scan the
    ifs files you created or you could try something like:
    find /QSYS.LIB/QGPL.LIB/USRLST.FILE/* -exec cat -c {}/; grep 'XXXX'
    To list the members you are interested in. It could be a codepage or
    ebcdic issue which someon has a better grasp of than me.
    The $ would not work as thats the end of line marker & you only seem
    to get one per member which isnt great.
    Its a pity some sort of regex processing isnt in fndstrpdm I would
    really like a where 'x' but not 'y'
    Sorry I cant be more helpful.

    Jonathan.

+ Reply to Thread