当前位置:网站首页>[shell] Reprint: batch replacement find awk sed xargs
[shell] Reprint: batch replacement find awk sed xargs
2022-07-26 19:49:00 【Better go against the wind than wait for the wind to come】
Find before replace
find / -name ini.txt|xargs sed -i 's/123/456/g'
Replace the same character in multiple files
When writing code, we often encounter the problem of .c and .h Some of the contents of the file are completely replaced , use sourceinsight Global search is a way , however sourceinsight You can only replace strings in one file , You cannot replace the same character in multiple files at the same time , stay linux Next Use find, combination sed,xargs This function can be realized .
Put... In the current directory all .c and .h In file Of "waf" character All Replace with “tamper”
find . -name "*.[ch]" |xargs sed -i 's/waf/tamper/g'
- hold 、/opt/test/ All under the directory contain "linux" Replace all character files with windows
The order is as follows
find /opt/test/ -type f | awk -F":" '{print $1}' |xargs sed -i's/linux/windows/g'
边栏推荐
- What is a knowledge management system? You need to know this
- 什么是联邦图机器学习?弗吉尼亚大学最新《联邦图机器学习:概念、技术和应用》综述
- SVN - 详细文档
- 聊聊如何用 Redis 实现分布式锁?
- TB 117-2013 US Federal mandatory regulations
- How to uninstall win11 edge? The method tutorial of completely uninstalling win11 edge browser
- LeetCode每日一练 —— 27. 移除元素
- C # create and read dat file cases
- EN 1504-7 products for protection and repair of concrete structures corrosion prevention of reinforcement - CE certification
- [MySQL must know and know] log details
猜你喜欢

Where can I find the files downloaded from iPad

How to protect e-commerce websites from network attacks?

Redis介绍

Redis6

基于华为云 IOT 设计智能称重系统 (STM32)【二】结尾有资料

客户案例|生学教育依托观测云打造可观测智慧教育新生态

【PHP】将 SESSION 数据保存到 Redis

canvas 图形

How to write the test case of mobile app? What are the mobile app test points?

MySQL教程:MySQL数据库学习宝典(从入门到精通)
随机推荐
Leetcode daily practice - 88. Merge two ordered arrays
How to uninstall win11 edge? The method tutorial of completely uninstalling win11 edge browser
软件测试——自动化测试框架有哪些?
[skim] two point answer solution
关于接口测试你想知道的都在这儿了
Pychart loads CONDA to create a pytorch virtual environment and reports an error. It is normal on the CONDA command line
How to adjust the abnormal win11 USB drive to normal?
iPhone开发 数据持久化总结(终结篇)—5种数据持久化方法对比
【PHP】使用 file_get_contents() 发送 GET、POST 请求
cuda11.2对应pytorch安装
MySQL教程:MySQL数据库学习宝典(从入门到精通)
Detailed explanation of Yolo V2
Linux regularly backs up the database and deletes the data n days ago
通过源码深度分析线程池中Worker线程的执行流程
DOM案例:10秒倒计时-写跳转页面相关的知识
C # create and read dat file cases
Redis6
论文精读:YOLOV2——YOLO9000:Better, Faster, Stronger
企业数字化转型成大趋势,选对在线协作工具很重要
J1: why is redis so fast + basic structure