The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-12-2008
namishtiwari namishtiwari is offline
Registered User
 

Join Date: Aug 2007
Location: Bangalore
Posts: 285
Quote:
Originally Posted by deeprajn95 View Post
i need to create a shell script, which will go into a directory , and scan the files in it for defined errors, there will be around 10 files in the directory.
This will work for you...

Code:
#!/usr/bin/ksh
for file is `ls directoryname`
do
echo $file
cat $file | grep -i "error pattern" >newfile
done
Reply With Quote