簡體   English   中英

如何使用 ripgrep 替換所有文件中的所有匹配項?

[英]How to use ripgrep to replace all matches within all files?

我可以使用以下命令在標准輸出中打印所有更改的文件和內容

rg --passthru -F "red" -r "green" -N

Output:

ip.txt
blue test1
green 2
hello blue world

ip2.txt
blue test1
green 2
hello blue world

ip3.txt
green test1
green 2
hello green world

ip4.txt
green test1
green 2
hello green world

如何將這些內容更改的文件寫入原始文件。

你不能單獨使用 ripgrep。 ripgrep 在設計上不支持它。 它從不寫入文件。 它只讀取它們。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM