Query on (standard input) messages being issued by script

Hi.

I'm working in an IBM mainframe UNIX environment and am running a script as follows:

for i in `find . -name *.xml -type f`
do
test -f $i && iconv -f IBM-932 -t IBM-1047 $i | egrep -l $1 && echo $1" found i
n" $i "searching as ASCII"
done

The idea is to locate all *.xml files beneath where I happen to be in the directory structure, convert then from ASCII to EBCDIC (necessary as egrep works on ebcdic files on the IBM mainframe platform) and then search for a particular string in them. If found then issue a message indicating that the string was found in the ascii file.

When I run it I see output like this:

(JENKINN-TAOS)/software/wasv6Config/W5Q/AsrvW5QE/profiles/default/config >~/nrjscan2 bam146dev
(standard input)
bam146dev found in ./cells/W5QdevUIMX/nodegroups/DefaultNodeGroup/nodegroup.xml searching as ASCII
(standard input)
bam146dev found in ./cells/W5QdevUIMX/nodes/W5QE/serverindex.xml searching as ASCII
(standard input)
bam146dev found in ./cells/W5QdevUIMX/nodes/W5QEDM/serverindex.xml searching as ASCII
(standard input)
bam146dev found in ./cells/W5QdevUIMX/nodes/W5QF/serverindex.xml searching as ASCII
(standard input)
bam146dev found in ./cells/W5QdevUIMX/security.xml searching as ASCII
(standard input)
bam146dev found in ./cells/W5QdevUIMX/virtualhosts.xml searching as ASCII
(JENKINN-TAOS)/software/wasv6Config/W5Q/AsrvW5QE/profiles/default/config >

Does anyone know why I'm getting the (standard input) between each of the lines being echo'd following a successful find ?

Thanks,
Neil.

You're asking egrep to display the filename (which is stdin) - you probably want -s instead of -l , or just redirect egrep's output to /dev/null.

1 Like

You are asking it to do so by giving grep the -l option.

1 Like

Thanks CarloM and RudiC. I have converted to -s on the egrep as CarloM suggested and now it doesn't throw the (standard input) message but shows me the result of the egrep instead. I've also tested the redirect to /dev/null and that works perfectly too with just the list of file names where the egrep was successfully produced so many thanks for the really quick response.