|
发表于 2004-7-12 22:56:06
|
显示全部楼层
没想出好的法子 :sorry
before:
/home/lee#cat file
This is a test,
abcde
hello
ok
abcde
the botto
abcde
m.
This is a test,
abcde
hello
ok
abcde
the botto
abcde
m.
[php]
cat file|while read i;do
echo $i
if echo $i|grep -A1 abcde >/dev/null;then
echo $i|tr '\n' ' '
fi
done|sed '/^abcde$/d'
[/php]
after:
This is a test,
abcde hello
ok
abcde the botto
abcde m.
This is a test,
abcde hello
ok
abcde the botto
abcde m.
相信有更好的方法  |
|