All,
I have a requirement where I will need to split a line into multiple lines.
Ex:
Input:
2ABCDEFGH2POIYUY2ASDGGF2QWERTY
Output:
2ABCDEFGH
2POIYUY
2ASDGGF
2QWERTY
The data is of no fixed lenght. Only the lines have to start with 2.
How can this be done. (5 Replies)
I am trying to figure out how to split a file when the data in the new line is different from the current line using a shell script?
For eg..
if my input file contains the following
2341123 ABCAD
2341123 ANCAED
2341123 AVADV
3343434 ASDVAV
3343434 ASDFADF
4231232 ADACVAV
4231232... (3 Replies)
Hi,
I want to split before reading the complete line as the line is very big and its throwing out of memory. can you suggest.
when i say
#cat $inputFile | while read eachLine
and use the eachLine to split its throwing out of memory as the line size is more than 10000000 characters.
Can you... (1 Reply)
Dear All,
I want to split single line into two line or three lines wherever “|” separated values comes using
Input line
test,DEMTEMPUT20100404010012,,,,,,,,|0070086|0070087,
output shoule be
test,DEMTEMPUT20100404010012,,,,,,,,0070086,
test,DEMTEMPUT20100404010012,,,,,,,,0070087, (14 Replies)
Hi all,
I have logs(in a log file) with the following structure
20100916011501559;0.812;null;TRUE;;FALSE;0.812;0;0;;19
20100916011504762;0.015;null;TRUE;;FALSE;0;4|4;0.015;;4
20100916011504762;0;null;TRUE;;FALSE;0;0;0;;4
20100916011501731;3.343;null;TRUE;;FALSE;3.156;131|65;0.172;;11... (14 Replies)
The requirement is, there is a log file which contains a huge data. i need to get a particular field out of it by searching with another field.
ex:
2011-03-28 13:00:07,423 : millis=231 q={ call get_data_account(?,?,?,?,?) }, params=
i need to search for the word "get_data_account" in file... (1 Reply)
HI Guys,
I need to split the file in to number of files . file contains FILEHEADER and EOF . I have to split n number of times . I have to form the file with each splitted message between FILEHEADER and EOF using awk beign and end . how to implement please suggest. (2 Replies)
Hi All,
I have file(File1) with data like below:
102100|LName|Gender|Company|Branch|Bday|Salary|Age
102100|bbbb|male|cccc|dddd|19900814|15000|20|
102101|asdg|male|gggg|ksgu|19911216|||
102102|bdbm|male|kkkk|acke|19931018||23|
102102|kfjg|male|kkkc|gkgg|19921213|14000|24|... (2 Replies)
Hi Gurus,
I have below JSON file, now I want to rewrite this file into a new file.
I will appreciate if anyone can help me to provide the solution...I can't use jq.
{
"_id": "3ad893cb4cf1560add7b4caffd4b6126",
"_rev": "1-1f0ce165e1d210319cf6e9f9c6ff654f",
"name":... (4 Replies)
Discussion started by: manas_ranjan
4 Replies
LEARN ABOUT DEBIAN
marc::file::usmarc
MARC::File::USMARC(3pm) User Contributed Perl Documentation MARC::File::USMARC(3pm)NAME
MARC::File::USMARC - USMARC-specific file handling
SYNOPSIS
use MARC::File::USMARC;
my $file = MARC::File::USMARC->in( $filename );
while ( my $marc = $file->next() ) {
# Do something
}
$file->close();
undef $file;
EXPORT
None.
METHODS
decode( $string [, &filter_func ] )
Constructor for handling data from a USMARC file. This function takes care of all the tag directory parsing & mangling.
Any warnings or coercions can be checked in the "warnings()" function.
The $filter_func is an optional reference to a user-supplied function that determines on a tag-by-tag basis if you want the tag passed to
it to be put into the MARC record. The function is passed the tag number and the raw tag data, and must return a boolean. The return of a
true value tells MARC::File::USMARC::decode that the tag should get put into the resulting MARC record.
For example, if you only want title and subject tags in your MARC record, try this:
sub filter {
my ($tagno,$tagdata) = @_;
return ($tagno == 245) || ($tagno >= 600 && $tagno <= 699);
}
my $marc = MARC::File::USMARC->decode( $string, &filter );
Why would you want to do such a thing? The big reason is that creating fields is processor-intensive, and if your program is doing read-
only data analysis and needs to be as fast as possible, you can save time by not creating fields that you'll be ignoring anyway.
Another possible use is if you're only interested in printing certain tags from the record, then you can filter them when you read from
disc and not have to delete unwanted tags yourself.
update_leader()
If any changes get made to the MARC record, the first 5 bytes of the leader (the length) will be invalid. This function updates the leader
with the correct length of the record as it would be if written out to a file.
_build_tag_directory()
Function for internal use only: Builds the tag directory that gets put in front of the data in a MARC record.
Returns two array references, and two lengths: The tag directory, and the data fields themselves, the length of all data (including the
Leader that we expect will be added), and the size of the Leader and tag directory.
encode()
Returns a string of characters suitable for writing out to a USMARC file, including the leader, directory and all the fields.
RELATED MODULES
MARC::Record
TODO
Make some sort of autodispatch so that you don't have to explicitly specify the MARC::File::X subclass, sort of like how DBI knows to use
DBD::Oracle or DBD::Mysql.
Create a toggle-able option to check inside the field data for end of field characters. Presumably it would be good to have it turned on
all the time, but it's nice to be able to opt out if you don't want to take the performance hit.
LICENSE
This code may be distributed under the same terms as Perl itself.
Please note that these modules are not products of or supported by the employers of the various contributors to the code.
AUTHOR
Andy Lester, "<andy@petdance.com>"
perl v5.10.1 2010-03-29 MARC::File::USMARC(3pm)