On Mon, 17 Dec 2007 05:14:46 -0800 (PST), Aglaee wrote:
Bonjour
Les fichiers que je traite ont des lignes assez grandes (> 1024 caractere). Le pb que j'ai est que un
cat monfichier | sed -e "s/blah/blah blah/" provoque des erreurs "Output line too long."
Quel est l'interet de conCATener un seul fichier !?
Comment puis je augmenter la taille d'une chaine de caractere pour sed ?
[...]
Tu ne peux pas. sed est un outil texte et un fichier qui a plus de LINE_MAX caracteres entre deux LF n'est pas un fichier texte.
Note que d'apres POSIX, LINE_MAX doit etre au moins 2048.
Utilise GNU sed ou perl a la place.
perl -pe 's/blah/blah blah/' < monfichier
-- Stephane
A l'impossible, nul ..... Je vais faire avec perl. Merci
Vincent Lefevre
Dans l'article <47667a8e$0$882$, Stephane Chazelas écrit:
Comment puis je augmenter la taille d'une chaine de caractere pour sed ? [...]
Tu ne peux pas. sed est un outil texte et un fichier qui a plus de LINE_MAX caracteres entre deux LF n'est pas un fichier texte.
Ce qui est idiot, car on doit souvent traiter des flux générés automatiquement. Il y avait comme ça un bug dans la compilation de GMP il y a quelques années. Donc éviter sed dans ses Makefile si on ne connaît pas a priori de borne sur la taille des lignes...
Note que d'apres POSIX, LINE_MAX doit etre au moins 2048.
A file that contains characters organized into one or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the <newline>. Although IEEE Std 1003.1-2001 does not distinguish between text files and binary files (see the ISO C standard), many utilities only produce predictable or meaningful output when operating on text files. The standard utilities that have such restrictions always specify "text files" in their STDIN or INPUT FILES sections.
Runtime Invariant Values (Possibly Indeterminate) {LINE_MAX} Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing <newline>. Minimum Acceptable Value: {_POSIX2_LINE_MAX}
Minimum Values {_POSIX2_LINE_MAX} Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing <newline>. Value: 2 048
Dans l'article <47667a8e$0$882$ba4acef3@news.orange.fr>,
Stephane Chazelas <stephane_chazelas@yahoo.fr> écrit:
Comment puis je augmenter la taille d'une chaine de caractere pour
sed ?
[...]
Tu ne peux pas. sed est un outil texte et un fichier qui a plus
de LINE_MAX caracteres entre deux LF n'est pas un fichier texte.
Ce qui est idiot, car on doit souvent traiter des flux générés
automatiquement. Il y avait comme ça un bug dans la compilation de
GMP il y a quelques années. Donc éviter sed dans ses Makefile si on
ne connaît pas a priori de borne sur la taille des lignes...
Note que d'apres POSIX, LINE_MAX doit etre au moins 2048.
A file that contains characters organized into one or more lines.
The lines do not contain NUL characters and none can exceed
{LINE_MAX} bytes in length, including the <newline>. Although IEEE
Std 1003.1-2001 does not distinguish between text files and binary
files (see the ISO C standard), many utilities only produce
predictable or meaningful output when operating on text files. The
standard utilities that have such restrictions always specify
"text files" in their STDIN or INPUT FILES sections.
Runtime Invariant Values (Possibly Indeterminate)
{LINE_MAX}
Unless otherwise noted, the maximum length, in bytes, of a
utility's input line (either standard input or another file),
when the utility is described as processing text files. The
length includes room for the trailing <newline>.
Minimum Acceptable Value: {_POSIX2_LINE_MAX}
Minimum Values
{_POSIX2_LINE_MAX}
Unless otherwise noted, the maximum length, in bytes, of a
utility's input line (either standard input or another file),
when the utility is described as processing text files. The
length includes room for the trailing <newline>.
Value: 2 048
Dans l'article <47667a8e$0$882$, Stephane Chazelas écrit:
Comment puis je augmenter la taille d'une chaine de caractere pour sed ? [...]
Tu ne peux pas. sed est un outil texte et un fichier qui a plus de LINE_MAX caracteres entre deux LF n'est pas un fichier texte.
Ce qui est idiot, car on doit souvent traiter des flux générés automatiquement. Il y avait comme ça un bug dans la compilation de GMP il y a quelques années. Donc éviter sed dans ses Makefile si on ne connaît pas a priori de borne sur la taille des lignes...
Note que d'apres POSIX, LINE_MAX doit etre au moins 2048.
A file that contains characters organized into one or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the <newline>. Although IEEE Std 1003.1-2001 does not distinguish between text files and binary files (see the ISO C standard), many utilities only produce predictable or meaningful output when operating on text files. The standard utilities that have such restrictions always specify "text files" in their STDIN or INPUT FILES sections.
Runtime Invariant Values (Possibly Indeterminate) {LINE_MAX} Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing <newline>. Minimum Acceptable Value: {_POSIX2_LINE_MAX}
Minimum Values {_POSIX2_LINE_MAX} Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing <newline>. Value: 2 048