I am trying to parse a file searching for specific set of string and then within those set of strings finding a keyword. The script works the way that I intended it to be but I thought it could be a lot simpler may be.
Any advice will be much appreciated.
The script at the moment is as below.
It initially grep for all strings starting with CREATE INDEX from a text file, x.txt and re-direct the result to a file name x.ksh.tmp.00.
Sample output of the x.ksh.tmp.00 is as below:
Then on a while loop, it read each line of the file x.ksh.tmp.00 taking from it the start and end line of which I then uses sed to search for the first line that start with the string elapsed:
I've uploaded the file x.txt. I've purposedly changed some of the strings but the does not affect the result of running the script. I just modify the string for security purposes. Excerpt of the file is as below:
Hi,
I have logfile like this..
=== 2014-02-09 15:46:59,936 INFO RequestContext - URL: '/eyisp/sc/skins/EY/images/pickers/comboBoxPicker_Over.png', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header
=== 2015-02-09... (8 Replies)
Hi !
I want to search a string in all lines with sed. If that string is there, i want to look for an other string in the next line.If that string is there i want to put an other line under it.
eg:
aaa
bbb
ccc
ddd
cat bla.txt | sed -e '/aaa/a\' -e ' \!!!'
in the upper case, i would... (6 Replies)
Hi,
I have log file which rolls out every second which is as this.
HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed
Bold letters are the stations . The whole file has multiple stations .
Below example i wanted to search... (4 Replies)
Hello,
I want to search 2 lines from the file. I wanted to display all such matches. Example file:
==================
Testfile is test
TEST1
TEST2
testing the file string
to do testing
TEST1
TEST2
sample strings
=================
I wanted to search the file with 2 lines
"
TEST1... (3 Replies)
I need to search this "<CardinalMPI>" string and replace the same string above two lines of the string.
Nov 16, 2012 12:58:34 PM
INFO: Centinel LookUp ResponseXML : <CardinalMPI>
<ReasonCode></ReasonCode>
<ErrorDesc></ErrorDesc>
<MerchantReferenceNumber></MerchantReferenceNumber>... (4 Replies)
What's the easiest way to search a file for a specific string and then look for other instances after that? I want to search for all Virtual Hosts and print out the Server Name and Document Root (if it has that info), while discarding the rest of the info.
Basically my file looks like this:
...... (6 Replies)
Hi Guys,
I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same.
can anyone of you please let me know how to go about it ? (8 Replies)
Hi,
The below code will search a particular string(say false in this case) and return me 10 lines above and below the search string in a file.
" awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print("***********************************");print;c=a;}b{r=$
0}' b=10 a=10 s="false" "
... (5 Replies)
Hi,
I have a file with the following contents:
COMPANY ABCD
TRUCKER JOE SMITH
TRUCK 456
PLATE A12345678
TRUCKER BILL JONES
TRUCK 789
PLATE B7894561
I need to create a script or search command that will search for this string '789' in the file. This string is unique and only... (7 Replies)