Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Jan 5 '10 at 14:31

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

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

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):

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)
/dev/stdin: ASCII text, with very long lines, with no line terminators
share|improve this answer

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

share|improve this answer

You must log in to answer this question.