Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-29-2013, 01:05 PM
|
#1
|
|
LQ Newbie
Registered: Sep 2011
Posts: 24
Rep: 
|
file command sees regular ASCII text file as ASCII Java program text
I need some assistance. I have regular ASCII text documents. If any of those documents have the word "import" in it, the file command sees it as ASCII Java program text. If these same files do not have that word in it, they are seen as ASCII text. This causes a problem with what we are doing. The text documents recognized as ASCII Java program get blocked. Does anyone know if there is some kind of linux update or bug or something??? Point me on where or how to search Google for something for help?
|
|
|
|
08-29-2013, 04:44 PM
|
#2
|
|
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281
|
It is called "magic". You can instruct "file" command to ommit some tests. "file" command do the best to guess file type, for example looking inside file for searching some pattern which could reveal its type. If you do not want this behavior you can exclude some tests by adding "-e" option, for example
Code:
file -e tokens not_java_file_with_import_inside.txt
Last edited by eSelix; 08-30-2013 at 08:36 AM.
Reason: Correcting "-e token" as noted by druuna
|
|
|
|
08-30-2013, 07:21 AM
|
#3
|
|
LQ Newbie
Registered: Sep 2011
Posts: 24
Original Poster
Rep: 
|
-e is not a file command option
When I run it with the -e option it tells me file: invalid option -e
|
|
|
|
08-30-2013, 07:54 AM
|
#4
|
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by bbraml
-e is not a file command option
When I run it with the -e option it tells me file: invalid option -e
|
Is this on Linux or some Unix variant?
Code:
$ file --version
file-5.04
magic file from /etc/magic:/usr/share/misc/magic
One other thing; It should be token s, not token:
Code:
$ file -e tokens not_java_file_with_import_inside.txt
tokens not_java_file_with_import_inside.txt: ASCII text
$ file not_java_file_with_import_inside.txt
tokens not_java_file_with_import_inside.txt: ASCII Java program text
|
|
|
|
08-30-2013, 08:08 AM
|
#5
|
|
LQ Newbie
Registered: Sep 2011
Posts: 24
Original Poster
Rep: 
|
This is on RHEL 5.7 linux
Code:
$ file --version
file-5.04
magic file from /etc/magic:/usr/share/misc/magic
|
|
|
|
08-30-2013, 08:35 AM
|
#6
|
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by bbraml
This is on RHEL 5.7 linux
Code:
$ file --version
file-5.04
magic file from /etc/magic:/usr/share/misc/magic
|
Are you sure about that? RHEL 5.7 and file version 5.04?
This is on my RHEL 5.7 box:
Code:
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
$ file --version
file-4.17
magic file from /usr/share/file/magic
Version 4 does not have an -e switch or something similar.
|
|
|
|
08-30-2013, 08:52 AM
|
#7
|
|
LQ Newbie
Registered: Sep 2011
Posts: 24
Original Poster
Rep: 
|
Sorry,
one server is 5.1 and another is 5.6
both are running file version 4.17
|
|
|
|
All times are GMT -5. The time now is 05:03 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|