07-16-2009
The problem with this approach is, It will also select file names with alphabets
Hi Tyler,
Thanks for your reply.
The problem with this approach
(find . -name "[0-9]*.xls" | xargs tar cvf pattern1.tar; gzip pattern1.tar)
is, It will also select those file names which contain any alphabets after the numbers. eg. it will also select those file names such as 32323TotalBalance.xls, 5656NegativeBalance.xls etc.
I need to select only those file names through the script whose name contains only numbers such as 43434.xls, 6767.xls etc.
Hoping for the reply.
Thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files.
a) /usr/users/oracle/bin
b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies
2. Shell Programming and Scripting
I have a directory full of zip files.
How would I write a bash script to enumerate all the zip files, remove the ".zip" from the file name, create a directory by that name and unzip each zip file into its corresponding directory?
Thanks!
Siegfried (3 Replies)
Discussion started by: siegfried
3 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I'm a newbie in shell script.
So, i would like to create a shell script which take 2 IN parameters (PARAM1 and PARAM2).
This script need to create 2 files as :
I need to create this file /etc/apache2/sites-available/PARAM2 :
<VirtualHost *:80>
DocumentRoot "/home/PARAM1/www"... (0 Replies)
Discussion started by: chatlumo
0 Replies
4. Shell Programming and Scripting
Hi ,
Please help me getting this done.
Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern.
(i) Conditions for creating log files.
Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for... (1 Reply)
Discussion started by: itian2010
1 Replies
5. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I need a help with zip and tar. I have no done any scripts before with zip command.
What I need to achieve is list files in a directory with a specific name (ID_DATE format- given examples) and then zip (or gunzip which I need to use, I am not sure) with timestamp on the file name and then... (15 Replies)
Discussion started by: Vijay81
15 Replies
7. Shell Programming and Scripting
Hi,
I am just new to scripting but got to write a complex scipt please help. i need a shell script which can check the list of data listed in a txt doc and see if they belong to any of the groups that are listed in other list file.... (5 Replies)
Discussion started by: draghun9
5 Replies
8. Shell Programming and Scripting
I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also?
I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies
9. Shell Programming and Scripting
Hi Expert,
We have some shell scripts which Internally uses Perl Script to Unzip the source zip files which comes to inbound directory. So now our requirement is to avoid the dependency on Perl Script and us Shell Script to unzip the files. I have the Perl script with me attached can some one... (3 Replies)
Discussion started by: naveen.dasu
3 Replies
10. UNIX for Beginners Questions & Answers
I have files in a Linux directory . Some of the file is listed below
-rw-rw-r--. 1 roots roots 0 Dec 23 02:17 zzz_123_00000_A_1.csv
-rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_121_00000_A_2.csv
-rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_124_00000_A_3.csv
drwxrwxr-x. 2 roots roots 6 Dec 23... (4 Replies)
Discussion started by: Balraj
4 Replies
LEARN ABOUT DEBIAN
dbd::excel
Excel(3pm) User Contributed Perl Documentation Excel(3pm)
NAME
DBD::Excel - A class for DBI drivers that act on Excel File.
This is still alpha version.
SYNOPSIS
use DBI;
$hDb = DBI->connect("DBI:Excel:file=test.xls")
or die "Cannot connect: " . $DBI::errstr;
$hSt = $hDb->prepare("CREATE TABLE a (id INTEGER, name CHAR(10))")
or die "Cannot prepare: " . $hDb->errstr();
$hSt->execute() or die "Cannot execute: " . $hSt->errstr();
$hSt->finish();
$hDb->disconnect();
DESCRIPTION
This is still alpha version.
The DBD::Excel module is a DBI driver. The module is based on these modules:
* Spreadsheet::ParseExcel
reads Excel files.
* Spreadsheet::WriteExcel
writes Excel files.
* SQL::Statement
a simple SQL engine.
* DBI
Of course. :-)
This module assumes TABLE = Worksheet. The contents of first row of each worksheet as column name.
Adding that, this module accept temporary table definition at "connect" method with "xl_vtbl".
ex.
my $hDb = DBI->connect(
"DBI:Excel:file=dbdtest.xls", undef, undef,
{xl_vtbl =>
{TESTV =>
{
sheetName => 'TEST_V',
ttlRow => 5,
startCol => 1,
colCnt => 4,
datRow => 6,
datLmt => 4,
}
}
});
For more information please refer sample/tex.pl included in this distribution.
Metadata
The following attributes are handled by DBI itself and not by DBD::Excel, thus they all work like expected:
Active
ActiveKids
CachedKids
CompatMode (Not used)
InactiveDestroy
Kids
PrintError
RaiseError
Warn (Not used)
The following DBI attributes are handled by DBD::Excel:
AutoCommit
Always on
ChopBlanks
Works
NUM_OF_FIELDS
Valid after "$hSt->execute"
NUM_OF_PARAMS
Valid after "$hSt->prepare"
NAME
Valid after "$hSt->execute"; undef for Non-Select statements.
NULLABLE
Not really working, always returns an array ref of one's. Valid after "$hSt->execute"; undef for Non-Select statements.
These attributes and methods are not supported:
bind_param_inout
CursorName
LongReadLen
LongTruncOk
Additional to the DBI attributes, you can use the following dbh attribute:
xl_fmt
This attribute is used for setting the formatter class for parsing.
xl_dir
This attribute is used only with "data_sources" on setting the directory where Excel files ('*.xls') are searched. It defaults to the
current directory (".").
xl_vtbl
assumes specified area as a table. See sample/tex.pl.
xl_skiphidden
skip hidden rows(=row height is 0) and hidden columns(=column width is 0). See sample/thidden.pl.
xl_ignorecase
set casesensitive or not about table name and columns. Default is sensitive (maybe as SQL::Statement). See sample/thidden.pl.
Driver private methods
data_sources
The "data_sources" method returns a list of '*.xls' files of the current directory in the form "DBI:Excel:xl_dir=$dirname".
If you want to read the subdirectories of another directory, use
my($hDr) = DBI->install_driver("Excel");
my(@list) = $hDr->data_sources(
{ xl_dir => '/usr/local/xl_data' } );
list_tables
This method returns a list of sheet names contained in the $hDb->{file}. Example:
my $hDb = DBI->connect("DBI:Excel:file=test.xls");
my @list = $hDb->func('list_tables');
TODO
More tests
First of all...
Type and Format
The current version not support date/time and text formating.
Joins
The current version of the module works with single table SELECT's only, although the basic design of the SQL::Statement module allows
joins and the likes.
KNOWN BUGS
o There are too many TODO things. So I can't determind what is BUG. :-)
AUTHOR
Kawai Takanori (Hippo2000) kwitknr@cpan.org
Homepage:
http://member.nifty.ne.jp/hippo2000/ (Japanese)
http://member.nifty.ne.jp/hippo2000/index_e.htm (English)
Wiki:
http://www.hippo2000.net/cgi-bin/KbWiki/KbWiki.pl (Japanese)
http://www.hippo2000.net/cgi-bin/KbWikiE/KbWiki.pl (English)
SEE ALSO
DBI, Spreadsheet::WriteExcel, Spreadsheet::ParseExcel, SQL::Statement
COPYRIGHT
Copyright (c) 2001 KAWAI,Takanori All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
perl v5.8.8 2008-03-01 Excel(3pm)