The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search a list of lines in file into files sriram003 UNIX for Advanced & Expert Users 2 05-20-2008 04:23 AM
How to List and copy the files containing a string redlotus72 UNIX for Dummies Questions & Answers 11 09-28-2007 08:58 AM
How list of files as input laknar Shell Programming and Scripting 4 06-25-2007 03:51 AM
List files that do not match the search pattern olapxpert UNIX for Dummies Questions & Answers 7 04-14-2005 12:49 PM
List files that do not match the search pattern olapxpert IP Networking 1 04-14-2005 11:37 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-08-2006
Registered User
 

Join Date: Mar 2006
Posts: 2
Search a string from list of input files

Hello,

I am trying to match a string between line one and line two with in the file. But I dont want to search based on the given filename. Instead I want to search for all available files in the specific directory. Please help me on the above.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-08-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
OK, what code have you written so far to try and solve this?

Cheers
ZB
Reply With Quote
  #3 (permalink)  
Old 03-08-2006
Registered User
 

Join Date: Mar 2006
Posts: 2
Smile

Hi,

Thanks for your reply. I completed the code, but if you can help me to modify the code then it will be really good.

for filename in *.*
do
PTYPE=`head -1 $filename | cut -c 14-14`
##echo $PTYPE
if [ $PTYPE = 'M' ]
then
FILE_PERIOD=`head -1 $filename | cut -c 12-16`
DATA_PERIOD=`head -2 $filename | tail -1 | cut -c 11-15`
elif [ $PTYPE = 'Q' ]
then
FILE_PERIOD=`head -1 $filename | cut -c 12-15`
DATA_PERIOD=`head -2 $filename | tail -1 | cut -c 11-14`
else
echo "Period in the fie $filename is not correct : $DATA_PERIOD "
fi
if [ $FILE_PERIOD = $DATA_PERIOD ]
then echo "File $filename Loading for Period : $FILE_PERIOD "
else
echo "Wrong File for the period $FILE_PERIOD in the $filename period is $DATA_PERIOD "
fi
done
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0