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}
Komut dosyası "stereo" adlı yürütülebilir bir dosyadaysa, yazın
stereo file.in [column_width [page_width ["r l"]]]
column_width bir sayıdır; 25-45 çalışacaktır, varsayılan değer 35'tir.
page_width bir sayıdır, column_width'in yaklaşık iki katı olmalı, varsayılan değer 80
Çapraz gözlü görüntüleme için, 4. argüman olarak "r l" kullanın. Varsayılan, paralel görüntüleme için ayarlanan "l r" dir.
EDIT: Dosyayı her satırda bir kelimeye bölmek, sonra sonunda tekrar monte etmek için yeniden yazıldı. Not: "=" işaretini kendi kullanımına ayırır. Giriş dosyasındaki herhangi bir "=" işareti boşluk bırakacaktır.
EDIT: Mesajınızda "=" işareti varsa, komut dosyası için 5. parametre olarak sağlayarak kullanılacak kod için başka bir simge seçebilirsiniz.
Örnek
Girdi: vejeteryanlık.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.
Sonuç
./stereo vegetarianism.txt 32 72 "l r": | genişlet (iç çalışma sembolü için iki nokta üst üste kullanarak)
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" | genişlet
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!
"| Genişletmek" gerekli değildir ancak çıktıyı 4 konuma kaydırırken TAB'lar yanlış ele alınır. Komut dosyasına 7 baytlık bir maliyetle yerleştirilebilir.
ImageMagick varyasyonu
Son satırı bir metinden resme ImageMagick komutuyla değiştirmek:
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:
Bunda paralel gözleme ve paralel görüntülemeye yönelik "r" ve "l" ayrı argümanlardır:
./im_stereo vegetarianism.txt 40 80 lr =
(kaynak: simplesystems.org )
EDIT 3: ImageMagick varyasyonu eklendi.