Sample input:
Loading File System
Networking in nature
Closing the System
now i need to extract the patterns between the words File and Closing:
i.e. sample output:
System
Networking in Nature
Thanks in advance !!!!!!!!!!!!!!!!! (6 Replies)
Hi Gurus,
I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Hi,
I have a data file with millions of record (N). Each record was saved in 4 lines. So there are total of NX4 lines in the data file.
For Example:
Host1
a
b
c
d
Host2
e
f
g
h
Host3
i
j
k (2 Replies)
Hi All,
I tried extracting this pattern using grep but it did not work.
What I have is a file which has contents like this:
file:///channel/add-adhd.html
file:///channel/allergies.html
file:///channel/arthritis.html
http://mail.yahoo.com/
http://messenger.yahoo.com/... (2 Replies)
Hello experts,
I have a text file from which I need to print all the lines between the patterns.
Could anyone please help me with the perl script.
names.txt
=========
Badger
Bald Eagle
Bandicoot
Bangle Tiger
Barnacle
Barracuda
Basilisk
Bass
Basset Hound
Beetle
Beluga... (7 Replies)
Hi,
I have a file with many lines and need to extract lines between 2 patterns (AAA and BBB) and merge all the in-between lines into single line separated by space.
$ cat file1
blah blah blah
blah AAA
1
2
3
blah BBB
blah blah blah
blah blah blah
blah blah blah
AAA
5
6
blah blah... (4 Replies)
Hello.
I am not having luck with sed or awk today.
$ echo "$BrackListFinal"
DSCF3649-DSCF3651_Brkt
DSCF3649.JPG 2014-07-21 13:34:44 On 1
DSCF3649.RAF 2014-07-21 13:34:44 On 1
DSCF3650.JPG 2014-07-21 13:34:45 On 2
DSCF3650.RAF 2014-07-21 13:34:45 On 2... (3 Replies)
I have a list in the format below, how do I read through the list and extract the lines between the ##START## and ##END##, so i can check for specific values between each ##START## & ##END## pattern
##START##
RANDOMTEXT
DFGSD
SDFSDF
##END##
##START##
morestuff
sdfggfg
sdfsdf... (10 Replies)
Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" .
I have attached sample input file and the desired input should be as:
INPUT FORMAT:
SELECT
ABCD,
DEFGH,
DFGHJ,
JKLMN,
AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
LEARN ABOUT DEBIAN
lfc_perl
lfc_perl(3) Perl Programmers Reference Guide lfc_perl(3)NAME
lfc - Perl interface to the LFC
SYNOPSIS
use lfc;
printf "CNS_LIST_BEGIN is %d
", $lfc::CNS_LIST_BEGIN;
DESCRIPTION
The lfc module permits you to access the LFC client interface from perl programs. The lfc module is a swig wrapping of the standard C
interface. For detailed descriptions of each function see the individual man page of each function.
There follows a series of examples of how to use selected functions and how to retrieve the information returned by them: Examples are
finding the GUID of an existing entry, listing the replicas of a given GUID and setting and retrieving the comment associated with an
entry.
EXAMPLE
#!/usr/bin/perl -w
use strict;
use lfc;
# stat an existing entry in the LFC and print the GUID
my ($name,$stat,$guid,$res);
$name = "/grid/dteam/my.test";
$stat = lfcc::new_lfc_filestatg();
$res = lfc::lfc_statg($name,undef,$stat);
if ($res == 0) {
$guid = lfcc::lfc_filestatg_guid_get($stat);
print "The GUID for $name is $guid
";
} else {
my $err_num = $lfc::serrno;
my $err_string = lfc::sstrerror($err_num);
print "There was an error while looking for $name: Error $err_num ($err_string)
";
exit(1);
}
lfcc::delete_lfc_filestatg($stat);
EXAMPLE
#!/usr/bin/perl -w
use strict;
use lfc;
# list the replicas of a given entry, starting from the GUID
my ($guid,$listp,$flag,$num_replicas);
$guid = "6a3164e0-a4d7-4abe-9f76-e3b8882735d1";
$listp = lfcc::new_lfc_list();
$flag = $lfc::CNS_LIST_BEGIN;
print "Listing replicas for GUID $guid:
";
$num_replicas=0;
while(1) {
my $res = lfc::lfc_listreplica(undef,$guid,$flag,$listp);
$flag = $lfc::CNS_LIST_CONTINUE;
if (!defined $res) {
last;
} else {
my $rep_name = lfcc::lfc_filereplica_sfn_get($res);
print "Replica: $rep_name
";
$num_replicas++;
}
}
lfc::lfc_listreplica(undef,$guid,$lfc::CNS_LIST_END,$listp);
lfcc::delete_lfc_list($listp);
print "Found $num_replicas replica(s)
";
EXAMPLE
#!/usr/bin/perl -w
use strict;
use lfc;
# setting and retrieving a comment on a file
my ($file,$res,$bufspec,$buffer,$comment);
$file = "/grid/dteam/my.test";
$comment = "MyComment";
$res = lfc::lfc_setcomment($file,$comment);
if ($res != 0) {
my $err_num = $lfc::serrno;
my $err_string = lfc::sstrerror($err_num);
print "Problem while setting comment for $file: Error $err_num ($err_string)
";
exit(1);
}
$bufspec = "x".($lfc::CA_MAXCOMMENTLEN+1);
$buffer = pack($bufspec);
$res = lfc::lfc_getcomment($file,$buffer);
if ($res != 0) {
my $err_num = $lfc::serrno;
my $err_string = lfc::sstrerror($err_num);
print "Problem while reading the comment for $file: Error $err_num ($err_string)
";
exit(1);
}
$comment = unpack("Z*", $buffer);
print "Read back comment $comment
";
NOTES
The current interface to the lfc_getcomment(3), lfc_getcwd(3), lfc_readlink(3), lfc_seterrbuf(3) requires the passing of a suitably allo-
cated buffer (in a similar way to the C functions). However this is rather non standard in PERL. A future version of lfc perl interface may
do away with the need to setup the buffer before the call and to explicitly unpack the result afterwards.
SEE ALSO
LFC C interface man pages
LFC $Date: 2007/02/23 10:03:07 $ lfc_perl(3)