Sponsored Content
Top Forums Shell Programming and Scripting Printing between 2 matches with Perl Post 302380727 by pludi on Wednesday 16th of December 2009 05:17:03 AM
Old 12-16-2009
Do you want to include the start and end pattern? If so:
Code:
perl -nle 'print if /start_pattern/../end_pattern/' yourfile

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to get the pos() of 2 str matches in one loop in perl

Hello all i have this simple loop that gets me every time the match of "<#" in my string something like that : my $str ="gggg<#nnnnn#>kkkk<#ssss#>llllll"; while($str =~m/<#/g){ print pos($str); } but now i like to get another pos in the same loop iteration , i will like to get the... (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

Matches and mismatches in perl

When we give an input sequence , the program should match with the pattern and give the matches and mismatches in the output. i will give you 2 small examples. if you cant get it pls let me know. i will try to give a clear idea. example 1: $a=APPLE; # let it be a pattern... (0 Replies)
Discussion started by: srisha
0 Replies

3. Shell Programming and Scripting

Perl printing error

Hi Scripting Gurus, I am new bee in perl, and trying to write a script which must print the free disk space availability of C and E drives. Please advice. Here is the script snippet and expected output: #!/usr/bin/perl use CGI qw/:html3 :standard/; $spaceuselog =... (4 Replies)
Discussion started by: ccsaviour
4 Replies

4. Shell Programming and Scripting

[Perl] Printing - Scalars

Hey Guys, I have some weird problem with printing scalars ... When I'm executing script both are printing in terminal ... But only one is printed to the file ? I don't know whats going on .. :) Btw .. I'm noobie :) took me lots of time to put this simple script together :) Thank you... (3 Replies)
Discussion started by: NDxiak
3 Replies

5. Shell Programming and Scripting

Perl line count if it matches a pattern

#!/usr/bin/perl use Shell; open THEFILE, "C:\galileo_integration.txt" || die "Couldnt open the file!"; @wholeThing = <THEFILE>; close THEFILE; foreach $line (@wholeThing){ if ($line =~ m/\\0$/){ @nextThing = $line; if ($line =~ s/\\0/\\LATEST/g){ @otherThing =... (2 Replies)
Discussion started by: nmattam
2 Replies

6. Shell Programming and Scripting

help with perl database printing

Hey guys i am using perl and trying to pull a list of books from a database and then populate the list in a separate TT2 file. When the list is generated there should be 39 book names. When I do the foreach statement in my tt2 below, the first statement gives me 39 Array(random number) and the... (1 Reply)
Discussion started by: Joey12
1 Replies

7. Shell Programming and Scripting

Perl: Counting matches

Hi, A perl newbie here so pretty sure it's something simple. Trying to figure out how to count matches with perl pattern matching. The following script opens a text data file and finds lines containing "PORT:" and I'd like to count how many of these are found. Any ideas? open(LOG,"<... (3 Replies)
Discussion started by: hdefjunkie
3 Replies

8. Shell Programming and Scripting

Help in printing n number of lines if a search string matches in a file

Hi I have below script which is used to grep specific errors and if error string matches send an email alert. Script is working fine , however , i wish to print next 10 lines of the string match to get the details of error in the email alert Current code:- #!/bin/bash tail -Fn0 --retry... (2 Replies)
Discussion started by: neha0785
2 Replies

9. Shell Programming and Scripting

Grep -w not printing exact matches

Dear All, Here is my input TAACGCACTTGCGGCCCCGGGATAAAAAAAAAAAAAAAAAAAAATGGATT NAGAGGGACGGCCGGGGGCATAAAAAAAAAAAAAAAAAAAAAGGGATTTC NGGGTTTTAAGCAGGAGGTGTCAAAAAAAAAAAAAAAAAAAAAGGGATTT NTGGAACCTGGCGCTAGACCAAAAAAAAAAAAAAAAAAAATGGATTTTTG ATACTTACCTGGCAGGGGAGATACCATGATCAATAAAAAAAAAAAAAAAA... (3 Replies)
Discussion started by: jacobs.smith
3 Replies
profiler(n)							   Tcl Profiler 						       profiler(n)

NAME
profiler - Tcl source code profiler SYNOPSIS
package require Tcl 8.3 package require profiler ?0.2? ::profiler::init ::profiler::dump pattern ::profiler::print ?pattern? ::profiler::reset ::profiler::suspend ?pattern? ::profiler::resume ?pattern? ::profiler::sortFunctions key DESCRIPTION
The profiler package provides a simple Tcl source code profiler. It is a function-level profiler; that is, it collects only function-level information, not the more detailed line-level information. It operates by redefining the Tcl proc command. Profiling is initiated via the ::profiler::init command. COMMANDS
::profiler::init Initiate profiling. All procedures created after this command is called will be profiled. To profile an entire application, this command must be called before any other commands. ::profiler::dump pattern Dump profiling information for the all functions matching pattern. If no pattern is specified, information for all functions will be returned. The result is a list of key/value pairs that maps function names to information about that function. The information about each function is in turn a list of key/value pairs. The keys used and their values are: totalCalls The total number of times functionName was called. callerDist A list of key/value pairs mapping each calling function that called functionName to the number of times it called function- Name. compileTime The runtime, in clock clicks, of functionName the first time that it was called. totalRuntime The sum of the runtimes of all calls of functionName. averageRuntime Average runtime of functionName. descendantTime Sum of the time spent in descendants of functionName. averageDescendantTime Average time spent in descendants of functionName. ::profiler::print ?pattern? Print profiling information for all functions matching pattern. If no pattern is specified, information about all functions will be displayed. The return result is a human readable display of the profiling information. ::profiler::reset Reset profiling information for all functions matching pattern. If no pattern is specified, information will be reset for all func- tions. ::profiler::suspend ?pattern? Suspend profiling for all functions matching pattern. If no pattern is specified, profiling will be suspended for all functions. It stops gathering profiling information after this command is issued. However, it does not erase any profiling information that has been gathered previously. Use resume command to re-enable profiling. ::profiler::resume ?pattern? Resume profiling for all functions matching pattern. If no pattern is specified, profiling will be resumed for all functions. This command should be invoked after suspending the profiler in the code. ::profiler::sortFunctions key Return a list of functions sorted by a particular profiling statistic. Supported values for key are: calls, exclusiveTime, compile- Time, nonCompileTime, totalRuntime, avgExclusiveTime, and avgRuntime. The return result is a list of lists, where each sublist con- sists of a function name and the value of key for that function. KEYWORDS
profile, performance, speed profiler 0.2 profiler(n)
All times are GMT -4. The time now is 02:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy