Sponsored Content
Top Forums Shell Programming and Scripting Perl script to sort an Excel file Post 302386809 by alister on Wednesday 13th of January 2010 04:29:10 PM
Old 01-13-2010
That looks fine, except for what I assume is a typo: the space between "source_txt_" and "file"

To be certain, I tested using nawk/osx and gawk/cygwin-winxp; both worked as expected.

It would help if you would share a reduced version of your source file, one english line and one bulgarian line (obfuscating any sensitive info, of course). Also, given the strange things that can happen in transit, a paste of a hex/octal dump of those bytes would be very helpful.

Example:

Code:
$ cat utf8-data 
English: I can eat glass
Bulgarian: Мога да ям стъкло, то не

$ od -c utf8-data 
0000000    E   n   g   l   i   s   h   :       I       c   a   n       e
0000020    a   t       g   l   a   s   s  \n   B   u   l   g   a   r   i
0000040    a   n   :     320 234 320 276 320 263 320 260     320 264 320
0000060  260     321 217 320 274     321 201 321 202 321 212 320 272 320
0000100  273 320 276   ,     321 202 320 276     320 275 320 265  \n    
0000117

$ awk '{ print $0 "\t" (/[\320-\323]/ ? "bg": "en")}' utf8-data
English: I can eat glass        en
Bulgarian: Мога да ям стъкло, то не     bg

Regards,
alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL: Split Excel Workbook to Indiv Excel files

Hi, I am trying to find a way to read an excel work book with multiple worksheets. And write each worksheet into a new excel file using perl. My environment is Unix. For example: I have an excel workbook TEST.xls and it has Sheet1, Sheet2, Sheet3 worksheets. I would like to create... (2 Replies)
Discussion started by: sandeep78
2 Replies

2. Shell Programming and Scripting

How to sort columns in excel(csv) file

i want sort columns with headers based on another file headers file1 eg: i'm having an empty file with only coumn names like lastname firstname title expirydate stlcno status etc... another file with same column names and some other as well but in different order... file2 eg:firstname... (2 Replies)
Discussion started by: Man83Nagesh
2 Replies

3. Shell Programming and Scripting

Sort Excel File

Hi, I am new to scripting. I have a requirement 1.convert excel 2007 format to excel 2003 fromat 2.sort the excel file -( all columns in descending order). This needs to be done progarmmatically. Please let me know what would be the possible steps that I would need to take inorder to... (2 Replies)
Discussion started by: eva13
2 Replies

4. UNIX and Linux Applications

Perl Script to read an excel file into an array and search in the UNIX directories

Hi, I want the Perl script with versions 5.8.2 and 5.8.5 starting with #!/usr/bin/perl The Perl program should read the excel file or text file line by line and taking into an array and search in the UNIX directories for reference file of .jsp or .js or .xsl with path .The Object names... (2 Replies)
Discussion started by: pasam
2 Replies

5. Shell Programming and Scripting

Writing excel file using perl : Excel file formatting changed

I am trying to create a program where user can input data in certain excel cells using user interface on internet....the programming is on perl and server is unix But when i parse data into excel the formatting of sheets is turned to default and all macro coding removed. What to do...Please... (7 Replies)
Discussion started by: mud_born
7 Replies

6. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

7. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

8. Shell Programming and Scripting

Tabbed multiple csv files into one single excel file with using shell script not perl

Hi Experts, I am querying backup status results for multiple databases and getting each and every database result in one csv file. so i need to combine all csv files in one excel file with separate tabs. I am not familiar with perl script so i am using shell script. Could anyone please... (4 Replies)
Discussion started by: ramakrk2
4 Replies

9. Shell Programming and Scripting

Perl script to fill the entire row of Excel file with color based on pattern match

Hi All , I have to write one Perl script in which I need to read one pre-existing xls and based on pattern match for one word in some cells of the XLS , I need to fill the entire row with one color of that matched cell and write the content to another excel Please find the below stated... (2 Replies)
Discussion started by: kshitij
2 Replies

10. UNIX for Beginners Questions & Answers

How to sort a column in excel/csv file?

I have to sort the 4th column of an excel/csv file. I tried the following command sort -u --field-separator=, --numeric-sort -k 2 -n dinesh.csv > test.csv But, it's not working. Moreover, I have to do the same for more than 30 excel/csv file. So please help me to do the same. (6 Replies)
Discussion started by: dineshkumarsrk
6 Replies
Excel::Writer::XLSX::Package::Packager(3pm)		User Contributed Perl Documentation	       Excel::Writer::XLSX::Package::Packager(3pm)

NAME
Packager - A class for creating the Excel XLSX package. SYNOPSIS
See the documentation for Excel::Writer::XLSX. DESCRIPTION
This module is used in conjunction with Excel::Writer::XLSX to create an Excel XLSX container file. From Wikipedia: The Open Packaging Conventions (OPC) is a container-file technology initially created by Microsoft to store a combination of XML and non-XML files that together form a single entity such as an Open XML Paper Specification (OpenXPS) document. <http://en.wikipedia.org/wiki/Open_Packaging_Conventions>. At its simplest an Excel XLSX file contains the following elements: ____ [Content_Types].xml | |____ docProps | |____ app.xml | |____ core.xml | |____ xl | |____ workbook.xml | |____ worksheets | | |____ sheet1.xml | | | |____ styles.xml | | | |____ theme | | |____ theme1.xml | | | |_____rels | |____ workbook.xml.rels | |_____rels |____ .rels The "Excel::Writer::XLSX::Package::Packager" class co-ordinates the classes that represent the elements of the package and writes them into the XLSX file. AUTHOR
John McNamara jmcnamara@cpan.org COPYRIGHT
X MM-MMXII, John McNamara. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. LICENSE
Either the Perl Artistic Licence <http://dev.perl.org/licenses/artistic.html> or the GPL <http://www.opensource.org/licenses/gpl-license.php>. DISCLAIMER OF WARRANTY
See the documentation for Excel::Writer::XLSX. perl v5.10.1 2012-04-02 Excel::Writer::XLSX::Package::Packager(3pm)
All times are GMT -4. The time now is 06:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy