not showing restore information while run script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting not showing restore information while run script
# 1  
Old 11-20-2007
not showing restore information while run script

Hello,

I have the following script to restore file and grep information. However, once it restore file, it showing a lot useless information and different to check which file have the statement "John price $200". Can I not show any information while running script. It only show..when found the string?
echo Please input list file name:
read listn
for file in `cat $listn.txt`
do
restore_file $file
cat $file |grep "John price $200"
done

expect output:
filename: XXXXXX
found string: John price $200
# 2  
Old 11-20-2007
Quote:
Originally Posted by happyv
Hello,

I have the following script to restore file and grep information. However, once it restore file, it showing a lot useless information and different to check which file have the statement "John price $200". Can I not show any information while running script. It only show..when found the string?
echo Please input list file name:
read listn
for file in `cat $listn.txt`
do
restore_file $file
cat $file |grep "John price $200"
done

expect output:
filename: XXXXXX
found string: John price $200
Try this:
Code:
echo Please input list file name:
read listn

for file in `cat $listn.txt`
do
   restore_file $file > /dev/null 2>&1
   grep "John price $200" $file > /dev/null 2>&1
   (( ! $? )) && printf "filename: $file \nfound string: \"John price $200\"\n"
done

(not tested)

Regards.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

"sudo su -" showing lot of information on OpenLDAP

Hello, I have configured new LDAP and new LDAP clients. When I do "sudo su -", it shows me lot of information, which is not required on screen. I am not sure, if any debug mode is enabled or from where it can be turned off. Please suggest, if it is know for you. -bash-3.2$ sudo su - sudo:... (8 Replies)
Discussion started by: solaris_1977
8 Replies

2. UNIX for Beginners Questions & Answers

How to run a shell script in background without showing in the terminal?

Hi Guys, i am having a script which checks for ip address is pingable or not,when i execute this script in terminal it keeps on showing the pinging status of every ip address and it takes more time when i check for 100 ip address,How to do run a script in background without showing in the terminal... (4 Replies)
Discussion started by: Meeran Rizvi
4 Replies

3. Shell Programming and Scripting

Shell script, sftp logfile not showing transfer information

Hello, Recently I have changed some crontab scripts which I execute to do different tasks mainly transfering some files from one server to the other. The main change was the protocol from ftp transfer to sftp. Ftp server was the MS Windows default service, and Sftp server is an proprietary sw... (4 Replies)
Discussion started by: enux
4 Replies

4. Shell Programming and Scripting

Script working when run manually but not in crontab showing path not found

i have a script running using variable defined in .profile when i run that script manually its working but when i run the same script through cron its giving path not found I had defined path in .profile (3 Replies)
Discussion started by: raj_saini20
3 Replies

5. Shell Programming and Scripting

user attributes not showing when I run the script

I am new to linux/unix scripting and working in one company on linux project. I got a script that when it executes should give us the users atributes showing who is retriving data? the script should show us who are the users reriving information. I ran that script as sudo ./test4 but finding the... (0 Replies)
Discussion started by: starter2011
0 Replies

6. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

7. AIX

mksysb restore - Wrong OS level for restore

Hi all, I am still working on my mksysb restore. My latest issue is during an alt_disk_install from tape I got the following error after all the data had been restored. 0505-143 alt_disk_install: Unable to match mksysb level 5.2.0 with any available boot images. Please correct this... (0 Replies)
Discussion started by: pobman
0 Replies

8. Programming

pthreads run time information

Hello, Can anybody please tell me how to get the time for which the thread has run in Solaris 5.7. I am trying to read from /proc/pid/lwp/lwpsinfo. However, I am getting only the start time and not the run time. I am using pthreads. Also, Is there a way to get the used stack size for the... (0 Replies)
Discussion started by: hmurali
0 Replies

9. Programming

Process Run time information

Hello, I am working on Sun Solaris 5.7. I am trying to read the running time of a process through a C program. One way I am reading it is by using the command ps -<pid> -f The other way is from the struct psinfo_t which is there under /proc/pid/psinfo. However, the two times are... (1 Reply)
Discussion started by: hmurali
1 Replies
Login or Register to Ask a Question