Next: , Previous: Print bash environment, Up: Examples   [Contents][Index]


4.5 ¹Ô¤Îʸ»ú¤òȿž¤¹¤ë

°Ê²¼¤Î¥¹¥¯¥ê¥×¥È¤Ï¡¤¹Ô¤Îʸ»ú¤Î°ÌÃÖ¤òȿž¤¹¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¤³¤È¤¬²Äǽ¤Ç ¤¹¡¥Æó¤Ä¤Îʸ»ú¤òƱ»þ¤Ë°Üư¤¹¤ë¥Æ¥¯¥Ë¥Ã¥¯¤Ç¡¤Ä¾´ÑŪ¤Ê¼ÂÁõ¤è¤ê¹â®¤Ë¤Ê¤ê ¤Þ¤¹¡¥

¥é¥Ù¥ëÄêµÁ¤ÎÁ°¤Îtx¥³¥Þ¥ó¥É¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡¥¤³¤ì¤Ït¥³¥Þ ¥ó¥É¤Ç¥Æ¥¹¥È¤µ¤ì¤ë¥Õ¥é¥°¤ò¥ê¥»¥Ã¥È¤¹¤ë¤¿¤á¤ËɬÍפˤʤ뤳¤È¤¬¤è¤¯¤¢¤ê¤Þ ¤¹¡¥

ÁÛÁüÎÏË­¤«¤ÊÆÉ¼Ô¤Ï¡¤¤³¤Î¥¹¥¯¥ê¥×¥È¤Î»È¤¤Êý¤¬Ê¬¤«¤ë¤Ç¤·¤ç¤¦¡¥Î㤨¤Ð¡¤ banner¤Î½ÐÎϤòȿž¤µ¤»¤ë¤³¤È¤Ç¤¹8

#!/usr/bin/sed -f

/../! b

# Reverse a line.  Begin embedding the line between two newlines
s/^.*$/\
&\
/
# Move first character at the end.  The regexp matches until
# there are zero or one characters between the markers
tx
:x
s/\(\n.\)\(.*\)\(.\n\)/\3\2\1/
tx
# Remove the newline markers
s/\n//g

Footnotes

(8)

¤³¤ì¤Ï¡¤banner ¤Î½ÐÎϤòËä¤á¤ë¾¤Î¥¹¥¯¥ê¥×¥È¤¬É¬ÍפǤ¹¡¥Î㤨¤Ð°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡¥

#! /bin/sh

banner -w $1 $2 $3 $4 |
  sed -e :a -e '/^.\{0,'$1'\}$/ { s/$/ /; ba; }' |
  ~/sedscripts/reverseline.sed