logo
  • 教程列表
  • SO官方文檔
  • Perl 單行
    • 從命令列執行一些 Perl 程式碼
    • 在 Windows 單行中使用雙引號字串
    • 列印與圖案匹配的線條(PCRE grep)
    • 用另一個子字串替換子字串(PCRE sed)
    • 僅列印某些欄位
    • 列印第 5 到 10 行
    • 就地編輯檔案
    • 將整個檔案作為字串讀取
    • 將檔案上傳到 mojolicious
  1. StackOverflow 文件
  2. Perl Language 教程
  3. Perl 單行
  4. 用另一個子字串替換子字串(PCRE sed)

用另一個子字串替換子字串(PCRE sed)

Created: November-22, 2018

perl -pe"s/foo/bar/g" file.txt

或就地:

perl -i -pe's/foo/bar/g' file.txt

在 Windows 上:

perl -i.bak -pe"s/foo/bar/g" file.txt
  • 僅列印某些欄位
  • 列印與圖案匹配的線條(PCRE grep)

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明