我有两个HTML文件--a.html
和b.html
.我想用a.html
分之一的标题标签替换b.html
中的标题标签.
我们将如何使用shell 脚本来实现这一点?我知道如何使用sed
命令在同一文件中进行简单的替换.
a.html个
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document AAAAA</title>
</head>
<body>
This is Document A
</body>
</html>
b.html个
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document BBBB</title>
</head>
<body>
This is Document B
</body>
</html>
b.html - afer running the script-通知"文件bbbbb"改为"文件AAAAA"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document AAAAA</title>
</head>
<body>
This is Document B
</body>
</html>