我想编写一个 shell 脚本,它将从标准输入读取文件,删除所有字符串和空行字符,并将输出写入标准输出。该文件如下所示:
#some lines that do not contain <html> in here
<html>a<html>
<tr><html>b</html></tr>
#some lines that do not contain <html> in here
<html>c</html>
因此,输出文件应包含:
#some lines that do not contain <html> in here
a
<tr>b</html></tr>
#some lines that do not contain <html> in here
c</html>
我尝试编写这个 shell 脚本:
read INPUT #read file from std input
tr -d '[:blank:]'
grep "<html>" | sed -r 's/<html>//g'
echo $INPUT
但是这个脚本根本不起作用。任何的想法?谢谢