Hi,
I need to extract the uncommon (better say incremental) part from 2 files say file_1 and file_2.
file_2 contains everything that is in file_1. That is file_2 has been created internally somehow :
cat file_1 temp_file > file_2
My objective is to extract the temp_file part from... (2 Replies)
Hi,
I was wondering if there is an easy way to strip off the required basename. I have a script called apb0110021.sh and the contents of the script are
typeset -u MScript=`basename $0 | cut -d. -f1`
scriptname=sys.Audit.ksh
parms="PROJECT1 dsAudit $MScript 1 BEGIN"
$SCRIPTS/$scriptname... (3 Replies)
Hi,
I am trying to extract part of a line using "awk". My requirement is to extract the value $6 (which is the last parameter) from a line. As the sixth value contains some space, i am getting only part of the string. so i am trying to extract from $6 to the end of the buffer.
How to do it... (7 Replies)
Hi Guys,
I have a very large XML feed (2.7 MB) which crashes the server at the time of parsing. Now to reduce the load on the server I have a cron job running every 5 min.'s. This job will get the file from the feed host and keep it in the local machine.
This does not solve the problem as... (9 Replies)
Hi,
I have a file few hundred MB's with text like one below in single line.
20091117 abc xyg 20091117 def ghi 20091118 ppp ttt 20091118 zzz zzz xxx
I need to extract part of line from 1st occurence of pattern 20091117
till first occurence of another pattern 20091118.
I tried... (3 Replies)
I have the code
message={TP=2012:09:23:00:00:00:GMT,SD=2012:09:23:00:00:00:GMT,SP=2,FT=CCGT,FG=3605}
I want to extract the FG=3605 parts of this. Please help. I am trying to do this using awk or unix. (5 Replies)
Hi,
I needed to extract some specific characters from a string based on user input. For example: After the script executes the user enters the following details:
Please enter the string: This is a shell script
Please enter the starting position: 11
Please enter the number of characters to be... (4 Replies)
I have a string:
2015-04-16 07:30:05,625000 +0900 xxxx.com
I just want to extract the time from the above line I am using the below syntax
x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/
$time = $2 . ':' . $3 . ':' . $4;
print $time
But it is not working. Can some1 please help (2 Replies)
Hi All,
I have log files as below.
log1.txt
<table name="content_analyzer" primary-key="id">
<type="global" />
</table>
<table name="content_analyzer2" primary-key="id">
<type="global" />
</table>
Time taken: 1.008 seconds
ID = gd54321bbvbvbcvb
<table name="content_analyzer"... (7 Replies)
Discussion started by: ROCK_PLSQL
7 Replies
LEARN ABOUT DEBIAN
class::dbi::mysql
Class::DBI::mysql(3pm) User Contributed Perl Documentation Class::DBI::mysql(3pm)NAME
Class::DBI::mysql - Extensions to Class::DBI for MySQL
SYNOPSIS
package Film;
use base 'Class::DBI::mysql';
__PACKAGE__->set_db('Main', 'dbi:mysql:dbname', 'user', 'password');
__PACKAGE__->set_up_table("film");
__PACKAGE__->autoinflate(dates => 'Time::Piece');
# Somewhere else ...
my $type = $class->column_type('column_name');
my @allowed = $class->enum_vals('column_name');
my $tonights_viewing = Film->retrieve_random;
DESCRIPTION
This is an extension to Class::DBI, containing several functions and optimisations for the MySQL database. Instead of setting Class::DBI as
your base class, use this instead.
METHODS
set_up_table
__PACKAGE__->set_up_table("table_name");
Traditionally, to use Class::DBI, you have to set up the columns:
__PACKAGE__->columns(All => qw/list of columns/);
__PACKAGE__->columns(Primary => 'column_name');
Whilst this allows for more flexibility if you're going to arrange your columns into a variety of groupings, sometimes you just want to
create the 'all columns' list. Well, this information is really simple to extract from MySQL itself, so why not just use that?
This call will extract the list of all the columns, and the primary key and set them up for you. It will die horribly if the table contains
no primary key, or has a composite primary key.
autoinflate
__PACKAGE__->autoinflate(column_type => 'Inflation::Class');
__PACKAGE__->autoinflate(timestamp => 'Time::Piece');
__PACKAGE__->autoinflate(dates => 'Time::Piece');
This will automatically set up has_a() relationships for all columns of the specified type to the given class.
We currently assume that all classess passed will be able to inflate and deflate without needing extra has_a arguments, with the example of
Time::Piece objects, which we deal with using Time::Piece::mysql (which you'll have to have installed!).
The special type 'dates' will autoinflate all columns of type date, datetime or timestamp.
create_table
$class->create_table(q{
name VARCHAR(40) NOT NULL PRIMARY KEY,
rank VARCHAR(20) NOT NULL DEFAULT 'Private',
serial INTEGER NOT NULL
});
This creates the table for the class, with the given schema. If the table already exists we do nothing.
A typical use would be:
Music::CD->table('cd');
Music::CD->create_table(q{
cdid MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
artist MEDIUMINT UNSIGNED NOT NULL,
title VARCHAR(255),
year YEAR,
INDEX (artist),
INDEX (title)
});
Music::CD->set_up_table;
drop_table
$class->drop_table;
Drops the table for this class, if it exists.
column_type
my $type = $class->column_type('column_name');
This returns the 'type' of this table (VARCHAR(20), BIGINT, etc.)
enum_vals
my @allowed = $class->enum_vals('column_name');
This returns a list of the allowable values for an ENUM column.
retrieve_random
my $film = Film->retrieve_random;
This will select a random row from the database, and return you the relevant object.
(MySQL 3.23 and higher only, at this point)
SEE ALSO
Class::DBI. MySQL (http://www.mysql.com/)
AUTHOR
Tony Bowden
BUGS and QUERIES
Please direct all correspondence regarding this module to:
bug-Class-DBI-mysql@rt.cpan.org
COPYRIGHT AND LICENSE
Copyright (C) 2001-2005 Tony Bowden.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License; either version 2 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
perl v5.10.0 2005-09-03 Class::DBI::mysql(3pm)