The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Script to save/restore files and dir permissions joangopan Shell Programming and Scripting 1 01-13-2009 10:48 AM
Script information needed chris1234 UNIX for Dummies Questions & Answers 3 12-17-2007 07:35 PM
Restore Script Chrisp Shell Programming and Scripting 1 04-16-2007 05:00 AM
Script execution information manthasirisha Shell Programming and Scripting 12 07-07-2006 09:54 AM
executing script not showing up in ps -efx herman404 Shell Programming and Scripting 6 09-11-2005 10:00 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-20-2007
happyv happyv is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 209
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 (permalink)  
Old 11-20-2007
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Quote:
Originally Posted by happyv View Post
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0