Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extract the value from string in perl
    primarykey
    data
    text
    <p>Below are the two line which i have to parse in the file and <strong><code>from first line</code></strong> I need to extract <code>"180000"</code> and from <strong>second line I</strong> need to extract <code>"49 , 59, 54 "</code>. </p> <pre><code>Line 1: &lt;Mon Aug 5 15:26:16:040.50 IST 2013&gt; | &lt;MNLOG&gt; &lt;Iteration : 1 Duration : 180000 seconds&gt; Line2: &lt;Mon Aug 5 15:26:16:044.93 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Remaining Time : 49 hours 59 min 54 sec &gt; </code></pre> <p>I have written the code but I looks very hard coded one . So if is there any way which i can use please let me know. </p> <p>My code is : </p> <pre><code> if($line =~ m/Iteration\s+:\s+1\s+Duration/) { print"$line\n"; my @words = split(/ /,$line); my $lengh = $#words; $Start_Duration = $words[14]; } if($line =~ m/Remaining\s+Time\s+:\s+\d+/) { my @words = split(/ /,$line); my $lengh = $#words; $Hours= $words[13]*3600; $Minuts= $words[15]*60; $Seconds= $words[17]; $Remaining_Time =$Hours+$Minuts+$Seconds; } </code></pre> <p>Log: </p> <pre><code>==================================================================================================== &lt;Mon Aug 5 15:26:16:040.50 IST 2013&gt; | &lt;MNLOG&gt; &lt;Iteration : 1 Duration : 180000 seconds&gt; ==================================================================================================== &lt;Mon Aug 5 15:26:16:042.11 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Total Weight : 34&gt; &lt;Mon Aug 5 15:26:16:042.88 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Total Objects : 34&gt; &lt;Mon Aug 5 15:26:16:043.87 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Random Number generated : 3&gt; &lt;Mon Aug 5 15:26:16:044.40 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Next Test : VideoStreamingSMS_APstress&gt; &lt;Mon Aug 5 15:26:16:044.93 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Remaining Time : 49 hours 59 min 54 sec &gt; &lt;Mon Aug 5 15:26:16:045.64 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Test Suite : concurrency_tests&gt; &lt;Mon Aug 5 15:26:16:046.26 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Running the test : VideoStreamingSMS_APstress&gt; &lt;Mon Aug 5 15:26:16:046.81 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Timeout for the test : 1500&gt; &lt;Mon Aug 5 15:26:16:050.04 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Parameters : 1&gt; &lt;Mon Aug 5 15:30:39:760.21 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Random Number generated : 13&gt; &lt;Mon Aug 5 15:30:39:760.69 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Next Test : CamcorderNoUsb_APstress&gt; &lt;Mon Aug 5 15:30:39:761.01 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Remaining Time : 49 hours 55 min 31 sec &gt; &lt;Mon Aug 5 15:30:39:761.28 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Test Suite : nousb_tests&gt; &lt;Mon Aug 5 15:30:39:761.54 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Running the test : CamcorderNoUsb_APstress&gt; &lt;Mon Aug 5 15:30:39:761.77 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Timeout for the test : 1500&gt; &lt;Mon Aug 5 15:30:39:762.01 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Parameters : 1&gt; &lt;Mon Aug 5 15:30:40:017.74 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Test Case : CamcorderNoUsb_APstress&gt; &lt;Mon Aug 5 15:30:40:018.47 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - uses spiderboard: 0&gt; &lt;Mon Aug 5 15:32:34:136.59 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Random Number generated : 13&gt; &lt;Mon Aug 5 15:32:34:137.16 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Next Test : WallpaperToggle_APstress&gt; &lt;Mon Aug 5 15:32:34:137.60 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Remaining Time : 49 hours 53 min 36 sec &gt; &lt;Mon Aug 5 15:32:34:137.92 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Test Suite : feature_tests&gt; &lt;Mon Aug 5 15:32:34:138.15 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Running the test : WallpaperToggle_APstress&gt; &lt;Mon Aug 5 15:32:34:138.38 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Timeout for the test : 1500&gt; &lt;Mon Aug 5 15:32:34:138.61 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - Parameters : 3&gt; &lt;Mon Aug 5 15:32:34:392.25 IST 2013&gt; | &lt;MNLOG&gt; &lt;TestRunnerUnit - Test Case : WallpaperToggle_APstress&gt; &lt;Mon Aug 5 15:32:34:392.97 IST 2013&gt; | &lt;DBLOG&gt; &lt;TestRunnerUnit - uses spiderboard: 0&gt; &lt;Mon Aug 5 15:32:36:395.53 IST 2013&gt; | &lt;MNLOG&gt; &lt;Installation - Waking the Device up and Unlocking it&gt; &lt;Mon Aug 5 15:32:36:396.17 IST 2013&gt; | &lt;DBLOG&gt; &lt;KeyMap_APstress - ADB keyevent : 6&gt; &lt;Mon Aug 5 15:33:36:407.53 IST 2013&gt; | &lt;DBLOG&gt; &lt;APStress_Command - Timeout on command: adb shell input keyevent 6&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload