08-10-2009
character count per record
Hello
can someone please advise.
I need to send records in a file that are over 10,000 characters long to a seperate file.
Any ideas?
Thanks
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
What I am trying to do is check if the database query returned any records.
If no records returned then output a message else output results to a file.
Right now if I take out the if and else statements the code runs fine and sends the email. If no records returned the email sends the column... (4 Replies)
Discussion started by: johnu122
4 Replies
3. Shell Programming and Scripting
i have a file named file_names.dat where there are several files along with their path.
exp:
/data1/dir1/CTA_ACD_20071208.dat
/data1/dir1/CTA_DFG_20071208.dat
i want to write a script which will create a csv file with the name of the file and record count of that file
the output file... (4 Replies)
Discussion started by: dr46014
4 Replies
4. 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
5. Shell Programming and Scripting
I have a flat file. How can i retrive the character count per record in whole file. Can anybody assist me on this
Cheers (9 Replies)
Discussion started by: subrat
9 Replies
6. UNIX for Dummies Questions & Answers
recod,amount,noofaccount,count
98,+00000187865779787,00319,000000640/
99,+00000187865779787,00001,000000642/
thsi is my input file my question is
1) Reduce the count on the 98 record by 2 (6 Replies)
Discussion started by: sgoud
6 Replies
7. Shell Programming and Scripting
Hi all,
I have written a scripts which count number of lines in all the files in a directory and write in a text file. I don't know how to format it while writing. OS suns solaris 10
my scripts is as below
for i in /ersdg3/ERS/ERS_INPUT_LOGS/RIO/LOGS/RIO_02-Aug-2012/ *.LOG
do
echo... (11 Replies)
Discussion started by: guddu_12
11 Replies
8. Shell Programming and Scripting
Hello All,
I got a requirement when I was working with a file. Say the file has unloads of data from a table in the form
1|121|asda|434|thesi|2012|05|24|
1|343|unit|09|best|2012|11|5|
I was put into a scenario where I need the field count in all the lines in that file. It was simply... (6 Replies)
Discussion started by: PikK45
6 Replies
9. Shell Programming and Scripting
Hello,
I do have folders containing having funny strings in their names and one space.
First, I do remove the funny strings and replace the space by an underscore.
find . -name '* *' | while read file;
do
target=`echo "$file" | sed 's/... (2 Replies)
Discussion started by: tempestas
2 Replies
10. UNIX for Dummies Questions & Answers
We have the below records where we need record count of every 30 minute like 00:01 to 00:30 so in that we will have 48 record count in 24 hrs , and also we need sum of record count from 00:01 to 23:30. Please find sample data as well.
00:01 21
00:02 23
00:03 34
00:04 34
00:05 30... (10 Replies)
Discussion started by: nadeemrafikhan
10 Replies
LEARN ABOUT DEBIAN
xml::sax::byrecord
XML::SAX::ByRecord(3pm) User Contributed Perl Documentation XML::SAX::ByRecord(3pm)
NAME
XML::SAX::ByRecord - Record oriented processing of (data) documents
SYNOPSIS
use XML::SAX::Machines qw( ByRecord ) ;
my $m = ByRecord(
"My::RecordFilter1",
"My::RecordFilter2",
...
{
Handler => $h, ## optional
}
);
$m->parse_uri( "foo.xml" );
DESCRIPTION
XML::SAX::ByRecord is a SAX machine that treats a document as a series of records. Everything before and after the records is emitted as-
is while the records are excerpted in to little mini-documents and run one at a time through the filter pipeline contained in ByRecord.
The output is a document that has the same exact things before, after, and between the records that the input document did, but which has
run each record through a filter. So if a document has 10 records in it, the per-record filter pipeline will see 10 sets of (
start_document, body of record, end_document ) events. An example is below.
This has several use cases:
o Big, record oriented documents
Big documents can be treated a record at a time with various DOM oriented processors like XML::Filter::XSLT.
o Streaming XML
Small sections of an XML stream can be run through a document processor without holding up the stream.
o Record oriented style sheets / processors
Sometimes it's just plain easier to write a style sheet or SAX filter that applies to a single record at at time, rather than having to
run through a series of records.
Topology
Here's how the innards look:
+-----------------------------------------------------------+
| An XML:SAX::ByRecord |
| Intake |
| +----------+ +---------+ +--------+ Exhaust |
--+-->| Splitter |--->| Stage_1 |-->...-->| Merger |----------+----->
| +----------+ +---------+ +--------+ |
| ^ |
| | |
| +---------->---------------+ |
| Events not in any records |
| |
+-----------------------------------------------------------+
The "Splitter" is an XML::Filter::DocSplitter by default, and the "Merger" is an XML::Filter::Merger by default. The line that bypasses
the "Stage_1 ..." filter pipeline is used for all events that do not occur in a record. All events that occur in a record pass through the
filter pipeline.
Example
Here's a quick little filter to uppercase text content:
package My::Filter::Uc;
use vars qw( @ISA );
@ISA = qw( XML::SAX::Base );
use XML::SAX::Base;
sub characters {
my $self = shift;
my ( $data ) = @_;
$data->{Data} = uc $data->{Data};
$self->SUPER::characters( @_ );
}
And here's a little machine that uses it:
$m = Pipeline(
ByRecord( "My::Filter::Uc" ),
$out,
);
When fed a document like:
<root> a
<rec>b</rec> c
<rec>d</rec> e
<rec>f</rec> g
</root>
the output looks like:
<root> a
<rec>B</rec> c
<rec>C</rec> e
<rec>D</rec> g
</root>
and the My::Filter::Uc got three sets of events like:
start_document
start_element: <rec>
characters: 'b'
end_element: </rec>
end_document
start_document
start_element: <rec>
characters: 'd'
end_element: </rec>
end_document
start_document
start_element: <rec>
characters: 'f'
end_element: </rec>
end_document
METHODS
new
my $d = XML::SAX::ByRecord->new( @channels, \%options );
Longhand for calling the ByRecord function exported by XML::SAX::Machines.
CREDIT
Proposed by Matt Sergeant, with advise by Kip Hampton and Robin Berjon.
Writing an aggregator.
To be written. Pretty much just that "start_manifold_processing" and "end_manifold_processing" need to be provided. See
XML::Filter::Merger and it's source code for a starter.
perl v5.10.0 2009-06-11 XML::SAX::ByRecord(3pm)