Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When you pass a text file to the Unix file command, it might tell you something like:

input.txt: UTF-8 Unicode English text, with very long lines

Can somebody tell me the minimum number of characters a line must contain to be considered very long? The man pages don't say anything about this and I don't want to search the source code. If someone can tell me how to put this question into a Google query which doesn't return a billion results, almost all of which are irrelevant, I'd be happy, too.

share|improve this question

migrated from stackoverflow.com Jan 5 '10 at 14:31

This question came from our site for professional and enthusiast programmers.

2  
Vote to move to superuser due to the reluctance to search the source code. –  Greg Hewgill Jan 5 '10 at 11:04
    
You guys have a point - I'll search the source code next time. Thanks, anyways! –  ferdystschenko Jan 5 '10 at 11:26

4 Answers 4

From ascmagic.c in the file source package on Ubuntu:

#include "names.h"

#define MAXLINELEN 300  /* longest sane line length */
#define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
          || (x) == 0x85 || (x) == '\f')

Seems like a line needs to be more than 300 characters to be considered "very long".

share|improve this answer

Over 300 chacracters, according to lines 52 and 214-215 in ascmagic.c in the source code.

The source code can be found here (link fetched from the Debian man page for file): ftp://ftp.astron.com/pub/file/

share|improve this answer

Brute force (plus this is a program, right? so it makes it programming related?):

$ for i in {1..301}; do printf "%${i}s" "." | file - | grep very && echo $i; done
/dev/stdin: very short file (no magic)
1
/dev/stdin: ASCII text, with very long lines, with no line terminators
301
share|improve this answer

A line is considered long if it has more than 300 characters.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.