The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 07:23 AM
How to List and copy the files containing a string redlotus72 UNIX for Dummies Questions & Answers 11 09-28-2007 11:58 AM
How list of files as input laknar Shell Programming and Scripting 4 06-25-2007 06:51 AM
List files that do not match the search pattern olapxpert UNIX for Dummies Questions & Answers 7 04-14-2005 03:49 PM
List files that do not match the search pattern olapxpert IP Networking 1 04-14-2005 02:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-08-2006
sivakumarvenkat sivakumarvenkat is offline
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.
  #2 (permalink)  
Old 03-08-2006
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
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
  #3 (permalink)  
Old 03-08-2006
sivakumarvenkat sivakumarvenkat is offline
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
Sponsored Links
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:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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