Bash, sed: 228 223 197 (242 - 70) = 172
c=${5:-=};R=$c;L=;for f in r l;do
e="sed -e ";$e"$ d;s/$\| */ \n/g" $1>m
o=1;for w in `$e"$ p;d" $1`;do
$e"$o,/^$w /s/^$w /$L$w$R /" m>n;o="/$c/"
cp n m;done;tr -d \\n<n|fold -sw${2:-35}|$e"s/$c/ /g">$f
L=$c;R=;done;pr -tmw${3:-80} ${4:-l r}
Befindet sich das Skript in einer ausführbaren Datei mit dem Namen "stereo", geben Sie Folgendes ein
stereo file.in [column_width [page_width ["r l"]]]
column_width ist eine Zahl; 25-45 wird funktionieren, Standard ist 35.
page_width ist eine Zahl, sollte etwa doppelt so groß sein wie column_width, Standard ist 80
Verwenden Sie "r l" als viertes Argument, wenn Sie mit den Augen schauen. Die Standardeinstellung ist "l r", die für die parallele Anzeige eingerichtet ist.
BEARBEITEN: Umschreiben, um die Datei in ein Wort pro Zeile zu teilen, und am Ende wieder zusammensetzen. Hinweis: Reserviert das Zeichen "=" für die eigene Verwendung. Alle "=" Zeichen in der Eingabedatei werden zu Leerzeichen.
BEARBEITEN: Wenn Ihre Nachricht ein "=" - Zeichen enthält, können Sie ein anderes Symbol für das zu verwendende Skript auswählen, indem Sie es als fünften Parameter angeben.
Beispiel
Eingabe: vegetarianism.txt:
I invented vegetarianism. It is a diet involving no meat, just
vegetables. It is also common in cows - they are awesome.
vegetarianism. is awesome.
Ergebnis
./stereo vegetarianism.txt 32 72 "l r": | expand (mit dem Doppelpunkt als internes Arbeitssymbol)
I invented vegetarianism. It I invented vegetarianism. It
is a diet involving no meat, is a diet involving no meat,
just vegetables. It is also just vegetables. It is also
common in cows - they are common in cows - they are
awesome. awesome.
./stereo washington.txt 35 75 "l r" | expand
In a little district west of In a little district west of
Washington Square the streets Washington Square the streets
have run crazy and broken have run crazy and broken
themselves into small strips themselves into small strips
called 'places'. These 'places' called 'places'. These 'places'
make strange angles and curves. make strange angles and curves.
One Street crosses itself a time One Street crosses itself a time
or two. An artist once discovered or two. An artist once discovered
a valuable possibility in this a valuable possibility in this
street. Suppose a collector with a street. Suppose a collector with a
bill for paints, paper and canvas bill for paints, paper and canvas
should, in traversing this route, should, in traversing this route,
suddenly meet himself coming suddenly meet himself coming
back, without a cent having been back, without a cent having been
paid on account! paid on account!
Das "| expand" ist nicht notwendig, aber wenn die Ausgabe um 4 Stellen verschoben wird, werden die TABs falsch behandelt. Es könnte zu einem Preis von 7 Bytes in das Skript eingefügt werden.
ImageMagick-Variante
Ersetzen der letzten Zeile durch einen ImageMagick-Befehl von Text zu Bild:
c=${6:-=};R=$c;L=;for f in r l;do
e="sed -e ";$e"$ d;s/$\| */ \n/g" $1>m
o=1;for w in `$e"$ p;d" $1`;do
$e"$o,/^$w /s/^$w /$L$w$R /" m>n;o="/$c/"
cp n m;done;tr -d \\n<n|fold -sw${2:-35}|$e"s/$c/ /g">$f
L=$c;R=;done;
convert -border 10x30 label:@${4:-l} label:@${5:-r} +append show:
In diesem Fall sind das "r" und das "l" für die gegenseitige Anzeige von Augen und Augenpaaren getrennte Argumente:
./im_stereo vegetarianism.txt 40 80 lr =

(Quelle: simplesystems.org )
EDIT 3: ImageMagick-Variation hinzugefügt.