02-20-2013
Print record count of a file using shell script
HI,
I need to print the record count of a file using shell script.
If the record count of a file excluding header and trailer record if greater than zero then print 'Record count of a file is xxxx records'.
If the record count is zero print 'zero records'
Thanks
Mahendra
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies
2. Shell Programming and Scripting
Hello Gurus,
We have a requirement to count the valid number of records in a comma delimited file with double quotes.
The catch here is..few records have a new line carriage within the double quotes,,say for ex:we have a file called accounts the record count is 4827..but the actual valid count... (5 Replies)
Discussion started by: ajaykk
5 Replies
3. Shell Programming and Scripting
i use unix command to take the record count for a file1
awk 'END{print NR}' filename
i already have a file2 which conatin the count like
...
..
rec_cnt=100
..
..
I want to replace the record in the file2 using the record i take from file1.
suggest me some simple ways of doing it... (2 Replies)
Discussion started by: er_zeeshan05
2 Replies
4. Shell Programming and Scripting
Hello All,
I have come across a small problem. It would be great if any of you could help me in resolving the issue.
one file named dummy.txt will be ftped to Unix machine twice daily. If i receive it second time in a day i need to do some processing with the file.
How to find the... (2 Replies)
Discussion started by: RSC1985
2 Replies
5. Shell Programming and Scripting
isql
select count(*) from Table
eof
How to assign record count output of isql query to a shell variable ? (4 Replies)
Discussion started by: vikram3.r
4 Replies
6. Shell Programming and Scripting
Hi,
I have a requirement in hand:
I have a file with millions of records say file 1.I have another file, say file 2 which has 2000 records in it. The requirement is to read file2 , and remove the read record from file 1 and move i to a seperate file, file 3.
For eg: Read file 2, get the... (5 Replies)
Discussion started by: kumara2010
5 Replies
7. Shell Programming and Scripting
I have file listed in my directory in following format
-rwxrwxr-x+ 1 test test 4.9M Oct 3 16:06 test20141002150108.txt
-rwxrwxr-x+ 1 test test 4.9M Oct 4 16:06 test20141003150108.txt
-rwxrwxr-x+ 1 test test 4.9M Oct 5 16:06 test20141005150108.txt
-rwxrwxr-x+ 1 test ... (2 Replies)
Discussion started by: krish2014
2 Replies
8. Shell Programming and Scripting
Hi,
Very good wishes to all!
Please help to provide the shell script for generating the record counts in filed wise from the .csv file
My question:
Source file:
Field1 Field2 Field3
abc 12f sLm
1234 hjd 12d
Hyd 34
Chn
My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies
9. Shell Programming and Scripting
Hi all;
Here is my file:
V1.3=4
V1.4=5
V1.1=3
V1.2=6
V1.3=6
Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ?
Thank you so much for help.
Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies
10. Shell Programming and Scripting
Hi All ,
We need one help on the below requirement.We have multiple pipe delimited .txt file(around 100 .txt files) present on one directory.We need the total record count of all the files present in that directory without header.File format as below :
... (8 Replies)
Discussion started by: STCET22
8 Replies
LEARN ABOUT OSX
svn::dump
SVN::Dump(3) User Contributed Perl Documentation SVN::Dump(3)
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_headers()->{'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.
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".
COPYRIGHT & LICENSE
Copyright 2006 Philippe 'BooK' Bruhat, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2008-06-12 SVN::Dump(3)