---
title: "Linux批量替换文本"
author: "hipeace87"
date: "2010-07-21T18:45:33Z"
tags: []
categories: ["操作系统"]
slug: "linux"
draft: false
lastmod: "2010-07-21T18:45:33Z"
id: 718188
url: "https://hipeace87.iteye.com/blog/718188"
---

今天网站被人批量挂马了，网上搜了相关资源，有sed\\find等命令

试了下sed的，没能成功，被挂的是一段JS

使用find将问题解决了，在这里记录下

 

ind -name 'xixi.php' |xargs perl -pi -e 's|hello|aa|g'

find -name '\*.html' |xargs perl -pi -e 's|aa|hello|g'

find -name '\*.html' |xargs perl -pi -e 's|&lt;script src="a.js(\[^&gt;]\*)&gt;&lt;/script&gt; ||g'      (注：好像只能匹配替换单行)