The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com



UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to differentiate two tar files siri_14 Shell Programming and Scripting 7 04-07-2009 04:01 PM
Please help Question about Excel Files and Unix arnab1978 UNIX for Dummies Questions & Answers 2 04-02-2009 02:54 AM
Multiple excel files processing on unix ucode_2482 UNIX for Dummies Questions & Answers 3 02-26-2009 04:02 PM
PERL: Split Excel Workbook to Indiv Excel files sandeep78 Shell Programming and Scripting 2 09-25-2008 08:21 AM
Exporting files from unix to Excel sheet bishweshwar UNIX for Advanced & Expert Users 3 03-21-2007 04:41 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 05-27-2009
phatak_rajan phatak_rajan is offline
Registered User
  
 

Join Date: May 2009
Posts: 1
Question Differentiate between MS Word and Excel files in Unix

Hi,

I want to differentiate between a MS Word and Excel file in Unix (not by extension). The condition which we are currently checking for is the pattern "\320\317\021\340" within first 40 bytes of the file. However this format is same in all MS Office files. Can somebody tell me any special characters which we can check which will differentiate between MS Word and MS Excel file.

Regards,
Rajan
  #2 (permalink)  
Old 05-27-2009
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,749
Excel files are BIFF format files - they don't have any special 'identifying' string.
Attached is the WORD binary file format.

Neither is very helpful. You can try Wotsit.org for more details.
AFAIK windows actually uses the extension to determine what app to to use to open
XLS and DOC files.
Attached Files
File Type: pdf WindowsCompoundBinaryFileFormatSpecification.pdf (646.8 KB, 12 views)
Bits Awarded / Charged to jim mcnamara for this Post
Date User Comment Amount
05-27-2009 Neo Excellent reply. 20,000
  #3 (permalink)  
Old 05-30-2009
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,322
phatak_rajanm, can you tell us what exactly is the use case ?
Can you use the 'file' unix / linux application ?
For example, if I touch a file, as in : "touch test.xls" and pass it for processing against file, as in : "file test.xls" it tells me - empty file. If I enter some text, it tells me : ascii text. At the same time, if I pass a real XLS file it says : "Microsoft Office Document". So, it seems to me that 'file' command makes the difference, but not based on the extension.
  #4 (permalink)  
Old 05-31-2009
CRGreathouse CRGreathouse is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 104
Quote:
Originally Posted by sysgate View Post
phatak_rajanm, can you tell us what exactly is the use case ?
Here's one natural use case: Open Excel files with Gnumeric but Word files in OpenOffice.
  #5 (permalink)  
Old 06-01-2009
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,322
Hm... I just noticed that the 'file' utility does not make difference between Excel files and Word files - both are presented as "Microsoft Office Document". I'm out of suggestions but relying on the file's extension can also work, you can just warn the users to pay attention on file's names and especially extensions.
Reply

Bookmarks

Tags
word excel unix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0