Query on (standard input) messages being issued by script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Query on (standard input) messages being issued by script
# 1  
Old 05-28-2014
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:
Code:
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:
Code:
(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.


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 05-28-2014 at 08:53 AM.. Reason: code tags...
# 2  
Old 05-28-2014
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.
This User Gave Thanks to CarloM For This Post:
# 3  
Old 05-28-2014
You are asking it to do so by giving grep the -l option.
This User Gave Thanks to RudiC For This Post:
# 4  
Old 05-28-2014
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Removing punctuations from file input or standard input

Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints. 1. The problem statement, all variables and given/known data: How do I write a shell script that takes in a file or... (4 Replies)
Discussion started by: fozilla
4 Replies

2. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

3. Shell Programming and Scripting

Need help to run sql query from a script..which takes input from a file

I need to run sql script from shell script which takes the input from a file and contents of file will be like : 12345 34567 78657 and query will be like : select seq_nbr from bus_event where event_nbr='12345'; select seq_nbr from bus_event where event_nbr='34567'; select seq_nbr... (1 Reply)
Discussion started by: rkrish
1 Replies

4. Shell Programming and Scripting

Reading from standard input

So, I am new to shell scripting and have a few problems. I know how to read from standard input but I do not know how to really compare it to say, a character. I am trying to compare it to a character and anything exceeding just a character, the user will get an output message, but the program... (7 Replies)
Discussion started by: Bungkai
7 Replies

5. Shell Programming and Scripting

Reading Standard Input

Hello, I am new to scripting. How do I read multiple lines from the command line? I know read reads one line, but if I have to read multiple lines, how should I do? Thanks, Prasanna (4 Replies)
Discussion started by: prasanna1157
4 Replies

6. Shell Programming and Scripting

Unix Shell scripting -How to skip User Standard input section from another script

All, problem Description: For example: I have two shell scripts(executables). let name it as script1 and script2.I'm trying to execute script1 from script2. while executing script2, script1 is asking for manual input(input from keyboard). Now i need to know how I can skip this user input... (3 Replies)
Discussion started by: techie99
3 Replies

7. Solaris

standard input

Please give me any example for standard input in Solaris. (6 Replies)
Discussion started by: karman0931
6 Replies

8. Shell Programming and Scripting

change standard input ?

Dear... I have a scrpit that contains multiple read command.... when I run the script I have to enter 3 variables so that I can get the output.. but, I dont want to put those 3 inputs manually every time... I want to make a shell that reads the 3 inputs from a file. the script name is... (4 Replies)
Discussion started by: yahyaaa
4 Replies

9. Shell Programming and Scripting

How to copy from standard input

I tried copy the output files from find command into a directory. Example, find / -name core 2>/dev/null | xargs cp???? I have known that we can use xargs to execute command lines from standard input but how to use it in this case. Or I can do something besides xargs. (2 Replies)
Discussion started by: lalelle
2 Replies

10. Shell Programming and Scripting

standard input

how can i redirect standard input? i dont remember :/, though could you redirec not from a command? i mean, to redirect always stdin and stout (1 Reply)
Discussion started by: Jariya
1 Replies
Login or Register to Ask a Question