grep

Es gibt unterschiedliche "grep"s, z.B.:

/usr/bin/grep
/usr/xpg4/bin/grep

Die 2. Variante hat Begrenzung des Eingabestrings auf 2048 Zeichen.

Beispiel:

# printf "%2047s" 1 | egrep -s 1; print $?
0
 
# printf "%2048s" 1 | egrep -s 1; print $?
1

Eine Fehlermeldung kommt leider nicht…

:!: NOTES

/usr/bin/grep
   Lines are limited only by the size of the available  virtual
   memory.  If  there  is a line with embedded nulls, grep will
   only match up to the first null;  if  it  matches,  it  will
   print the entire line.

/usr/xpg4/bin/grep

   The results are unspecified if  input  files  contain  lines
   longer  than LINE_MAX bytes or contain binary data. LINE_MAX
   is defined in /usr/include/limits.h.
grep LINE_MAX /usr/include/limits.h
#define _POSIX2_LINE_MAX                2048
#define LINE_MAX                _POSIX2_LINE_MAX

Stand: 22.10.2009

EOF