![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |