Hi
I have a myfile.txt contains the following:
CONTEXT {
AAAAA
}
...
CONTEXT {
BBBBB
}
I want to extract the lines in between CONTEXT { ... }, one by one.
Hence I wrote a command like the following,
sed -n '/^CONTENT/,/^}/ {
w a.txt
}' myfile.txt
The problem with this... (5 Replies)
HI,
I have sentences like this:
@str=("An ribonucleic acid (RNA)-binding protein, started its expression in the daughter cells","Elucidation of the mechanism of retinal degeneration of RNA-binding protein","Rna binding protein is an important protein","In the retinal degenerative process... (1 Reply)
Hi,
I have the file contents:
Start,End,Req,Resp
12:39,12:40,4,5
The sting to be matched is: Req and Resp.
parsefile("Req,Resp");
Here is the code.
sub parsefile ($)
{
$header=shift; (2 Replies)
I have an ugly conf file that has the string I'm interested in searching for in the middle of a block of code that's relevant, and I'm trying to find a way to remove that entire block based on the matched line.
I've googled for this problem, and most people helping are only interested in... (9 Replies)
hi dudes, I nee you kind assistance, I have to find the matched numbers from 2 text files and output of matched numbers should be in another text file..
I do have text files like this , for example
File 1
787
665*5-p
5454
545-p
445-p
5454*-p
File 2
5455
787
445-p
4356
2445
144
... (3 Replies)
Hi all,
I have a text data file. My aim here is to find line called *FIELD* AV for every record and print lines after that till *FIELD* RF. But here I want first 3 to four lines for very record as well. FIELD AV is some where in between for very record. SO I am not sure how to retrieve lines in... (2 Replies)
Hi ,
I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code.
my $current_value=12345;
my @users=("bob","ben","tom","harry");
open DBLIST,"<","/var/tmp/DBinfo";
my @input = <DBLIST>;
foreach (@users)
{
my... (11 Replies)
Hi,
i need help to delete all the lines between 2 matched patterns and the first pattern must be deleted too. sample as follows:
inputfile.txt
>kump_1
...........................
...........................
>start_0124
dgfhghgfh
fgfdgfh
fdgfdh
>kump_2
............................. (7 Replies)
Hi,
If I have a file of something like
@hg19_gold_AL122127.6-131160
GCTTCATCATGCATGGATAGGCTGGCGCCTTTCCTGAGGCCATATGCCGATGGATATG
@hg19_gold_AL122127.6-131159
CTTTAATATTTCCGCCACCATCCTGAGTGAATCCCAGCAAGGACAGTCTTTGGGGATT
@hg19_gold_AL122127.6-131158... (4 Replies)
Hello, everyone
I have two files like this:
File 1: A
B
C
D
E
FFile 2:A B 1
A C 2
A K 3
B A 4
D E 3
W X 2
A B 2I want to print all lines (file2) that the first two columns are consist of elements from file1.
So, what I expected is :
A B 1
A B 2 (2 Replies)
Discussion started by: nengcheng
2 Replies
LEARN ABOUT DEBIAN
filter::eof
Filter::EOF(3pm) User Contributed Perl Documentation Filter::EOF(3pm)NAME
Filter::EOF - Run a callback after a file has been compiled
VERSION
0.04
SYNOPSIS
package MyPackage;
use warnings;
use strict;
use Filter::EOF;
sub import {
my ($class, @args) = @_;
my $caller = scalar caller;
# set the COMPILE_TIME package var to a false value
# when the file was compiled
Filter::EOF->on_eof_call(sub {
no strict 'refs';
${ $caller . '::COMPILE_TIME' } = 0;
});
# set the COMPILE_TIME package var to a true value when
# we start compiling it.
{ no strict 'refs';
${ $caller . '::COMPILE_TIME' } = 1;
}
}
1;
...
package MyUsingPackage;
use warnings;
use strict;
our $COMPILE_TIME;
use MyPackage;
# prints 'yes'
BEGIN { print +( $COMPILE_TIME ? 'yes' : 'no' ), "
" }
# prints 'no'
print +( $COMPILE_TIME ? 'yes' : 'no' ), "
";
1;
DESCRIPTION
This module utilises Perl's source filters to provide you with a mechanism to run some code after a file using your module has been pro-
cessed.
METHODS
"import( @functions )"
Currently, only a function equivalent of the "on_eof_call" method is provided for export.
use Filter::EOF qw( on_eof_call );
sub import {
my ($class) = @_;
...
on_eof_call { ... };
}
...
"on_eof_call( $code_ref )"
Call this method in your own "import" method to register a code reference that should be called when the file "use"ing yours was compiled.
The code reference will get a scalar reference as first argument to an empty string. if you change this string to something else, it will
be appended at the end of the source.
# call C<some_function()> after runtime.
Filter->on_eof_call(sub {
my $append = shift;
$$append .= '; some_function(); 1;';
});
EXPORTS
on_eof_call
You can optionally import the "on_eof_call" function into your namespace.
EXAMPLES
You can find the example mentioned in "SYNOPSIS" in the distribution directory "examples/synopsis/".
SEE ALSO
Filter::Call::Util, "Exporting without using Exporter's import method" in Exporter
AUTHOR AND COPYRIGHT
Robert 'phaylon' Sedlacek - "<rs@474.at>". Many thanks to Matt S Trout for the idea and inspirations on this module.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.
perl v5.8.8 2008-03-08 Filter::EOF(3pm)