![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 read lines in a text file and filter user data | srimal | Shell Programming and Scripting | 4 | 4 Weeks Ago 01:35 AM |
| URGENT: Script/Function needed to read text property files in block wise | ysreenivas | Shell Programming and Scripting | 7 | 05-11-2009 03:08 AM |
| help needed in a shell script for printing files | shahshilpa | Shell Programming and Scripting | 1 | 01-06-2009 09:44 AM |
| shell script to read data from text file and to load it into a table in TOAD | pallavishetty | Shell Programming and Scripting | 1 | 10-31-2008 04:15 AM |
| read list of filenames from text file and remove these files in multiple directories | fxvisions | Shell Programming and Scripting | 5 | 08-07-2008 03:59 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Shell Script Needed to Read a text from a list files
Hi,
Below is my issue which I desperately need and I want a shell script which can do this job. I need this script as I m planning to put this for a system health check. Please assist me. 1. There are 10 log files in a particular location. 2. open each log file. Goto to the end of the file. From the end go up to find a particular text. From this particular text till the end of the log search for another particular text. 3. if the particular text exists in the file return the file name(s) as the output. Please help me with the script. Thanks a lot to all. Thanks and Regards Shriram |
|
||||
|
I think you're question is worded strangly, but based on what I think you want:
Code:
awk '
/find1/ { P = 1 }
P && /find2/ { print FILENAME; P = 0; nextfile}
' file*
|
|
||||
|
I agree the request is hard to understand but I think what is needed:
Code:
awk '/pattern 1/ {line1=FNR}
/pattern 2/ {line2=FNR}
END { if(line1 < line2)
{print FILENAME}
}' *.logfile > reportfile
|
|
||||
|
Thanks a lot for your help, support and time. I will try this command and will get back shortly. Once again Thanks a LOT.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|