---
title: "shell：搜索目录中的txt文件，并修改文件内容"
author: "EclipseEye"
date: "2015-03-18T11:12:18Z"
tags: []
categories: ["互联网"]
slug: "shell-txt"
draft: false
lastmod: "2015-03-18T11:20:11Z"
id: 2193463
url: "https://niub.iteye.com/blog/2193463"
---

方法一
find ./ -name "*.txt" | while read f; do sed -i '1i welcome to eclipseeye 23333333'; done

方法二
find ./ -name "*.txt" | xargs sed -i '1i welcome to eciipseeye 23333'


方法三
find ./ -name "*.txt" -exec sed -i '1i welcom to eciipseeye 23333' {} \

