10-11-2012
IMO: your idea lacks merit.
You should simply insert the data into a db with a loader, then produce output. If you have Excel you have MS office and probably a db like Access. UNIX has free db's: mysql, Berekely db, etc.
So, Why does your idea look like reinventing the wheel?
The reason is that Don Cragun is right. You have to have complete metadata for each and every column to be able to sort based on arbitrary column selections. And there is too much metadata to cobble together anything useful in shell. Metadata can change. db's are meant for that contingency.
The way it is now, you have to know what you are sorting by looking at it - in effect gathering metadata. You have to use human intelligence to make decisions. Then use unix sort/Excel sort. Databases are meant to do this. You just tell db's to sort on column names, optionally: ascending or descending for each column. You can write database scripts (SQL language for example) to do stats or a lot of what you already can do in Excel.
So, stay in Excel or move to a db. I vote for a db.
This User Gave Thanks to jim mcnamara For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi friends,
I want to use sort command in script. I used the following syntax in my scipt,
sort -t '|' +3 tempcdrext4.cdr > temp.mocdr
It give me a error " Input file specified two times."
but this command work fine in the prompt without any problem.
Can sombody please tell me who... (2 Replies)
Discussion started by: maheshsri
2 Replies
2. UNIX for Dummies Questions & Answers
ok.
i am doing a project where i have hand typed in the titles of nearly 500 DVD titles, each one is on a seperate line.
but they arent in any type of alphebetical order, and i need them sorted in that format (A-Z or a-z) .....
i know that the 'sort' command can be used but also know the... (6 Replies)
Discussion started by: Chadbot
6 Replies
3. Shell Programming and Scripting
Hi All,
I have a .csv file with 3 columns called nLats, nLongs, and fRes. in following format :
"nLats","nLongs","fRes"
0,0,-1
0,1,-1
0,2,-1
0,3,-1
0,4,-1
.........
.........
0,143,-1 nLats increments at nLongs=143
1,0, -1
1,1, -1
..........
..........
1,143,-1... (1 Reply)
Discussion started by: wizardy_maximus
1 Replies
4. Shell Programming and Scripting
I have a file with four fields and an awk script that strips out one field displaying the remaining three. I have added headings for each of these fields such as Player - Year - RBIs then below it comes the data. What I am trying to do is sort the RBIs field in my script from most to least at the... (9 Replies)
Discussion started by: Trellot
9 Replies
5. Shell Programming and Scripting
Hi i have a file like this
oprvdw vrc002093j.ksh
oprvdw vrc002092j.ksh
oprvrc vrc045016j.ksh
oprvrc vrc055141j.ksh
svemietl bdw0231185.sh
svemietl bdw0231145.sh
and i need a script which dispalys in below format:
oprvdw :
vrc002093j.ksh
vrc002092j.ksh
oprvrc :... (0 Replies)
Discussion started by: p_satyambabu
0 Replies
6. UNIX for Advanced & Expert Users
Hello all -
I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies
7. UNIX for Dummies Questions & Answers
hi guys
i looking for someone to help me with a script
i want to sort all de files from /bin by size (from max to min) and the size and path of first 3 files to be written in /home/user/bin_size .And i want to put that script in crontab to execute every monday at 20:00
Can someone help me... (2 Replies)
Discussion started by: G30
2 Replies
8. Shell Programming and Scripting
Hi Experts,
I have a filelist collected from another server , now want to sort the output using date/time stamp filed.
- Filed 6, 7,8 are showing the date/time/stamp.
Here is the input:
#----------------------------------------------------------------------
-rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies
9. Shell Programming and Scripting
Hi geeks!
I want to convert the following:
EPC-NotificationData: sms:2348034503643
EPC-GroupIds: 300H:10:22-01-2014T07:30:14,22-04-2014T07:30:14
To:
EPC-NotificationData: sms:2348034503643, EPC-GroupIds: 300H:10:22-01-2014T07:30:14,22-04-2014T07:30:14
I want them to be on the same... (13 Replies)
Discussion started by: infinitydon
13 Replies
10. UNIX for Beginners Questions & Answers
I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 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)