Sponsored Content
Top Forums Shell Programming and Scripting Problem in perl program in printing all the entries Post 302646387 by kaav06 on Friday 25th of May 2012 04:18:45 AM
Old 05-25-2012
Problem in perl program in printing all the entries

Hi all,

I have a perl program where it checks for the presence of a particular line and prints the record if that line is present. But in the output file, all the entries are not being printed even if the entry has that line. The line to be matched is *FIELD* AV. The program which I wrote is given below. I have no idea where I might be wrong. Any suggestions are welcome. Thanks in advance.

Code:
#!/usr/bin/perl
$/="\n\n";
open(DATA,'mutationsonly.txt');
# or die("Could not open mutationsonly file.");
open(MYOUTPUT, ">newmutations.txt");
# or die ("could not open newmutations file.");
my @records= <DATA>;
close(MYOUTPUT);
close(DATA);
foreach my $record (@records)
{
chomp;
my $find=/^\*FIELD\*\sAV$/;
if ($record=~m/ $find /) 
{
print "$record";
}
}

 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Problem using mailx instead of mail in perl program

I have a perl program that uses the mail program to send emails. It works fine but because I want to change the return address on the emails to be different I need to use mailx with the "-r" option. the problem is when I change this line to use mailx I no longer recieve "any" emails. This works... (1 Reply)
Discussion started by: kieranfoley
1 Replies

3. 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

4. Shell Programming and Scripting

Printing between 2 matches with Perl

Can we please modify this perl one-liner to print lines between pattern1 and pattern2 in a file? Currently it prints lines till pattern2. (4 Replies)
Discussion started by: anand_bh
4 Replies

5. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 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

Need help in Perl Script for printing next line

I got multiple of documents in which i have to extract a line coming after a ID..The scenario is Customer ID: none VT : 002/89 Customer ID: Yes VT: 001/89 Customer ID: none VT: 006/85 Customer ID: Yes VT: 003/56 I have to extract the id which is coming after YES..The output... (7 Replies)
Discussion started by: rajkrishna89
7 Replies

8. Shell Programming and Scripting

Creating Printing Program in bash

HI I am trying to create a bash script to print whatever i type in It has to have these below to define the size of the label and what size to print the text N q609 A100,10,0,5,2,2,N," " P1 It has to be sent to below > /dev/usblp0 So what it has to be is Written... (12 Replies)
Discussion started by: bganse
12 Replies

9. Shell Programming and Scripting

count number of entries perl program or Unix script

Hi I have a file with number of entries name 1 123 name 1 345 name 1 65346 name2 3243 name2 24234 name 2 234234 so on ......... how to count total number of entries for name 1 and name2...and so on Please guide. (1 Reply)
Discussion started by: manigrover
1 Replies

10. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies
SVN::Dump(3pm)						User Contributed Perl Documentation					    SVN::Dump(3pm)

NAME
SVN::Dump - A Perl interface to Subversion dumps SYNOPSIS
#!/usr/bin/perl use strict; use warnings; use SVN::Dump; my $file = shift; my $dump = SVN::Dump->new( { file => $file } ); # compute some stats my %type; my %kind; while ( my $record = $dump->next_record() ) { $type{ $record->type() }++; $kind{ $record->get_header('Node-action') }++ if $record->type() eq 'node'; } # print the results print "Statistics for dump $file: ", " version: ", $dump->version(), " ", " uuid: ", $dump->uuid(), " ", " revisions: ", $type{revision}, " ", " nodes: ", $type{node}, " "; print map { sprintf " - %-7s: %d ", $_, $kind{$_} } sort keys %kind; DESCRIPTION
This module is an alpha release. The interfaces will probably change in the future, as I slowly learn my way inside the SVN dump format. An "SVN::Dump" object represents a Subversion dump. This module follow the semantics used in the reference document (the file notes/fs_dumprestore.txt in the Subversion source tree): o A dump is a collection of records ("SVN::Dump::Record" objects). o A record is composed of a set of headers (a "SVN::Dump::Headers" object), a set of properties (a "SVN::Dump::Property" object) and an optional bloc of text (a "SVN::Dump::Text" object). o Some special records ("delete" records with a "Node-kind" header) recursively contain included records. Each class has a "as_string()" method that prints its content in the dump format. The most basic thing you can do with "SVN::Dump" is simply copy a dump: use SVN::Dump; my $dump = SVN::Dump->new( 'mydump.svn' ); print $dump->as_string(); # only print the dump header while( $rec = $dump->next_record() ) { print $rec->as_string(); } After the operation, the resulting dump should be identical to the original dump. METHODS
"SVN::Dump" provides the following methods: new( \%args ) Return a new "SVN::Dump" object. The argument list is a hash reference. If the "SVN::Dump" object will read information from a file, the arguments "file" is used (as usal, "-" means "STDIN"); if the dump is read from a filehandle, "fh" is used. Extra options will be passed to the "SVN::Dump::Reader" object that is created. If the "SVN::Dump" isn't used to read information, the parameters "version" and "uuid" can be used to initialise the values of the "SVN-fs-dump-format-version" and "UUID" headers. next_record() Return the next record read from the dump. This is a "SVN::Dump::Record" object. version() format() Return the dump format version, if the version record has already been read, or if it was given in the constructor. uuid() Return the dump UUID, if there is an UUID record and it has been read, or if it was given in the constructor. as_string() Return a string representation of the dump specific blocks (the "format" and "uuid" blocks only). SEE ALSO
"SVN::Dump::Reader", "SVN::Dump::Record". The reference document for Subversion dumpfiles is at: <http://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt> COPYRIGHT
Copyright 2006-2011 Philippe Bruhat (BooK), All Rights Reserved. LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2011-03-22 SVN::Dump(3pm)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy