Sponsored Content
Top Forums Shell Programming and Scripting Perl script to sort an Excel file Post 302386661 by degoor on Wednesday 13th of January 2010 05:27:21 AM
Old 01-13-2010
Question Perl script to sort an Excel file

Hello!

I need to sort a file that is partly in English partly in Bulgarian.

The original file is an Excel file but I converted it to a tab-delimited text file. The encoding of the tab delimited file is UTF-8.

To sort the text, the script should test every line of the text file to see if there are any Cyrillic UTF-8 characters.

Even if a single Cyrillic character is found, it will be quite enough to conclude that the line is in Bulgarian. If no Cyrillic character is found, then the text should be in English.

The UTF-8 range of Cyrillic characters is U+0400 to U+04FF

After finding a Cyrillic character the script should add at the end the same line Tab+'bg'; when no Cyrillic character is found in the line, Tab+'en' should be added to the end of the line. I need the tabs so that I can open the file back in Excel and sort the lines.

I believe the script should be best written in Perl.

My system is MS Windows XP Professional. I have cygwin+Perl and Strawberry Perl installed.

Thanks in advance!

Last edited by degoor; 01-13-2010 at 07:49 AM.. Reason: Missed word
 

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
iconv(5)						Standards, Environments, and Macros						  iconv(5)

NAME
iconv - code set conversion tables DESCRIPTION
The following code set conversions are supported: Code Set Conversions Supported Code Symbol Target Code Symbol Target Output ISO 646 646 ISO 8859-1 8859 US ASCII ISO 646de 646de ISO 8859-1 8859 German ISO 646da 646da ISO 8859-1 8859 Danish ISO 646en 646en ISO 8859-1 8859 English ASCII ISO 646es 646es ISO 8859-1 8859 Spanish ISO 646fr 646fr ISO 8859-1 8859 French ISO 646it 646it ISO 8859-1 8859 Italian ISO 646sv 646sv ISO 8859-1 8859 Swedish ISO 8859-1 8859 ISO 646 646 7 bit ASCII ISO 8859-1 8859 ISO 646de 646de German ISO 8859-1 8859 ISO 646da 646da Danish ISO 8859-1 8859 ISO 646en 646en English ASCII ISO 8859-1 8859 ISO 646es 646es Spanish ISO 8859-1 8859 ISO 646fr 646fr French ISO 8859-1 8859 ISO 646it 646it Italian ISO 8859-1 8859 ISO 646sv 646sv Swedish ISO 8859-16 iso16 ISO 8859-2 iso2 ISO Latin 2 ISO 8859-2 iso2 ISO 8859-16 iso16 ISO Latin 10 ISO 8859-16 iso16 IBM 850 ibm850 IBM 850 code page ISO 8859-16 iso16 IBM 870 ibm870 IBM 870 code page ISO 8859-2 iso2 MS 1250 win2 Windows Latin 2 ISO 8859-2 iso2 MS 852 dos2 MS-DOS Latin 2 ISO 8859-2 iso2 Mazovia maz Mazovia IBM 850 ibm850 ISO 8859-16 iso16 ISO Latin 10 IBM 870 ibm870 ISO 8859-16 iso16 ISO Latin 10 MS 1250 win2 DHN dhn Dom Handlowy Nauki MS 852 dos2 ISO 8859-2 iso2 ISO Latin 2 MS 852 dos2 MS 1250 win2 Windows Latin 2 MS 852 dos2 Mazovia maz Mazovia MS 852 dos2 DHN dhn Dom Handlowy Nauki Mazovia maz ISO 8859-2 iso2 ISO Latin 2 Mazovia maz MS 1250 win2 Windows Latin 2 Mazovia maz MS 852 dos2 MS-DOS Latin 2 Mazovia maz DHN dhn Dom Handlowy Nauki DHN dhn ISO 8859-2 iso2 ISO Latin 2 DHN dhn MS 1250 win2 Windows Latin 2 DHN dhn MS 852 dos2 MS-DOS Latin 2 DHN dhn Mazovia maz Mazovia ISO 8859-5 iso5 KOI8-R koi8 KOI8-R ISO 8859-5 iso5 PC Cyrillic alt Alternative PC Cyrillic ISO 8859-5 iso5 MS 1251 win5 Windows Cyrillic ISO 8859-5 iso5 Mac Cyrillic mac Macintosh Cyrillic KOI8-R koi8 ISO 8859-5 iso5 ISO 8859-5 Cyrillic KOI8-R koi8 PC Cyrillic alt Alternative PC Cyrillic KOI8-R koi8 MS 1251 win5 Windows Cyrillic KOI8-R koi8 Mac Cyrillic mac Macintosh Cyrillic PC Cyrillic alt ISO 8859-5 iso5 ISO 8859-5 Cyrillic PC Cyrillic alt KOI8-R koi8 KOI8-R PC Cyrillic alt MS 1251 win5 Windows Cyrillic PC Cyrillic alt Mac Cyrillic mac Macintosh Cyrillic MS 1251 win5 ISO 8859-5 iso5 ISO 8859-5 Cyrillic MS 1251 win5 KOI8-R koi8 KOI8-R MS 1251 win5 PC Cyrillic alt Alternative PC Cyrillic MS 1251 win5 Mac Cyrillic mac Macintosh Cyrillic Mac Cyrillic mac ISO 8859-5 iso5 ISO 8859-5 Cyrillic Mac Cyrillic mac KOI8-R koi8 KOI8-R Mac Cyrillic mac PC Cyrillic alt Alternative PC Cyrillic Mac Cyrillic mac MS 1251 win5 Windows Cyrillic CONVERSIONS
The conversions are performed according to the tables contained in the manual pages cross-referenced in the Index of Conversion Code Tables below. +--------------------------------------------------------------+ | Index of Conversion Code Tables | +--------------------+--------------------+--------------------+ | Code | Target Code | See Manual Page | +--------------------+--------------------+--------------------+ |ISO 646 |ISO 8859-1 | iconv_646(5) | +--------------------+--------------------+--------------------+ |ISO 646de |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 646da |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 646en |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 646es |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 646fr |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 646it |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 646sv |ISO 8859-1 | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646 | iconv_8859-1(5) | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646de | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646da | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646en | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646es | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646fr | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646it | | +--------------------+--------------------+--------------------+ |ISO 8859-1 |ISO 646sv | | +--------------------+--------------------+--------------------+ |ISO 8859-2 |MS 1250 | iconv_8859-2(5) | +--------------------+--------------------+--------------------+ |ISO 8859-2 |MS 852 | | +--------------------+--------------------+--------------------+ |ISO 8859-2 |Mazovia | | +--------------------+--------------------+--------------------+ |ISO 8859-2 |DHN | | +--------------------+--------------------+--------------------+ |MS 1250 |ISO 8859-2 | iconv_1250(5) | +--------------------+--------------------+--------------------+ |MS 1250 |MS 852 | | +--------------------+--------------------+--------------------+ |MS 1250 |Mazovia | | +--------------------+--------------------+--------------------+ |MS 1250 |DHN | | +--------------------+--------------------+--------------------+ |MS 852 |ISO 8859-2 | iconv_852(5) | +--------------------+--------------------+--------------------+ |MS 852 |MS 1250 | | +--------------------+--------------------+--------------------+ |MS 852 |Mazovia | | +--------------------+--------------------+--------------------+ |MS 852 |DHN | | +--------------------+--------------------+--------------------+ |Mazovia |ISO 8859-2 | iconv_maz(5) | +--------------------+--------------------+--------------------+ |Mazovia |MS 1250 | | +--------------------+--------------------+--------------------+ |Mazovia |MS 852 | | +--------------------+--------------------+--------------------+ |Mazovia |DHN | | +--------------------+--------------------+--------------------+ +--------------------------------------------------------------+ | Index of Conversion Code Tables | +--------------------+--------------------+--------------------+ | Code | Target Code | See Manual Page | +--------------------+--------------------+--------------------+ |DHN |ISO 8859-2 | iconv_dhn(5) | +--------------------+--------------------+--------------------+ |DHN |MS 1250 | | +--------------------+--------------------+--------------------+ |DHN |MS 852 | | +--------------------+--------------------+--------------------+ |DHN |Mazovia | | +--------------------+--------------------+--------------------+ |ISO 8859-5 |KOI8-R | iconv_8859-5(5) | +--------------------+--------------------+--------------------+ |ISO 8859-5 |PC Cyrillic | | +--------------------+--------------------+--------------------+ |ISO 8859-5 |MS 1251 | | +--------------------+--------------------+--------------------+ |ISO 8859-5 |Mac Cyrillic | | +--------------------+--------------------+--------------------+ |KOI8-R |ISO 8859-5 | iconv_koi8-r(5) | +--------------------+--------------------+--------------------+ |KOI8-R |PC Cyrillic | | +--------------------+--------------------+--------------------+ |KOI8-R |MS 1251 | | +--------------------+--------------------+--------------------+ |KOI8-R |Mac Cyrillic | | +--------------------+--------------------+--------------------+ |PC Cyrillic |ISO 8859-5 | iconv_pc_cyr(5) | +--------------------+--------------------+--------------------+ |PC Cyrillic |KOI8-R | | +--------------------+--------------------+--------------------+ |PC Cyrillic |MS 1251 | | +--------------------+--------------------+--------------------+ |PC Cyrillic |Mac Cyrillic | | +--------------------+--------------------+--------------------+ |MS 1251 |ISO 8859-5 | iconv_1251(5) | +--------------------+--------------------+--------------------+ |MS 1251 |KOI8-R | | +--------------------+--------------------+--------------------+ |MS 1251 |PC Cyrillic | | +--------------------+--------------------+--------------------+ |MS 1251 |Mac Cyrillic | | +--------------------+--------------------+--------------------+ |Mac Cyrillic |ISO 8859-5 | iconv_mac_cyr(5) | +--------------------+--------------------+--------------------+ |Mac Cyrillic |KOI8-R | | +--------------------+--------------------+--------------------+ |Mac Cyrillic |PC Cyrillic | | +--------------------+--------------------+--------------------+ |Mac Cyrillic |MS 1251 | | +--------------------+--------------------+--------------------+ FILES
/usr/lib/iconv/*.so conversion modules /usr/lib/iconv/*.t Conversion tables. /usr/lib/iconv/geniconvtbl/binarytables/*.bt Conversion binary tables. /usr/lib/iconv/iconv_data List of conversions supported by conversion tables. SEE ALSO
iconv(1), iconv(3C), iconv_1250(5), iconv_1251(5), iconv_646(5), iconv_852(5), iconv_8859-1(5), iconv_8859-2(5), iconv_8859-5(5), iconv_dhn(5), iconv_koi8-r(5), iconv_mac_cyr(5), iconv_maz(5), iconv_pc_cyr(5), iconv_unicode(5) SunOS 5.10 5 Dec 2001 iconv(5)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy