|
ls >tmp.nospace
sed -e 's/\ //g' tmp.nospace >tmp2.nospace
我可以把目录中的文件名放在一个文件中,然后删除其中的空格. 但是怎样把原来的文件名赋给一个数组,再用tmp2.nospace中每一行的文件名替换旧的文件名? 或者有什么更方便的办法达到这个目标?
下面的是一个简单的将.txt文件转成.htm文件的脚本,缺点是当文件名带空格时会出错。
#txt2html
sed -e 'a<p>' $1 > $1.htm
cat /download/html_start.part $1.htm /download/html_end.part > $1.html
rm $1.htm
#/download/html_start.part
<html>
<head>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<style>
body{margin:2em 2em 2em 2em;word-spacing:1em;line-height:25pt}
</style>
</head>
<body>
#/download/html_end.part
</body>
</html> |
|