全部博文(2065)
分类: LINUX
2009-03-12 17:17:32
<[^>]*>
\[[^]]\{1,\}\]
sed '/^[[:space:]]*$/d' filename
/\(<[^>]*>\)/例如:从html文件中剔除html标签
sed 's/\(<[^>]*>\)//g;/^[[:space:]]*$/d' file.html
[b:4c6c2a6554][color=red:4c6c2a6554]一. 替换[/color:4c6c2a6554][/b:4c6c2a6554]
sed 's/\[[^]]\{1,\}\]//g' filename
Month, Day, Year [A-Z][a-z]\{3,9\}, [0-9]\{1,2\}, [0-9]\{4\}
2003-01-28 或 2003.10.18 或 2003/10/10 或 2003 10 10
\([0-9]\{4\}[ /-.][0-2][0-9][ /-.][0-3][0-9]\)
\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)
\(\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\)
[-+]*[0-9]\{1,\} 整数
[-+]*[0-9]\{1,\}\.[0-9]\{1,\} 浮点数
echo "WeLoveChinaUnix"|sed -e 'H;s/\(..\).*/\1/;x;s/.*\(.\{9\}\)$/\1/;x;G;s/\n/ /'
We ChinaUnix
echo 20030922|sed 's/\(....\)\(..\)\(..\)/\1 \2 \3/'|read year month day
echo $year $month $day
sed '1!G;h;$!d' oldfile >newfile