For system administrator
  • Blog
  • About
  • Archives
  1. Tags
  2. perl

Работа с текстом во FreeBSD dos2unix, unix2dos, удаление BOM в консоли.

Замена текста:

Способ 1: Замена подстроки с помощью perl:

perl -e 's/foo/bar/g' -pi ./index.html

Способ 2: Замена с помощью sed:

sed -e 's/foo/bar/g'  ./index.html > index_new.html

Способ 3: Замена с помощью awk

awk '{gsub("foo", "bar", $0); print > FILENAME}' ./index.html

Полезные …

more ...

  • Social

    • Github
    • stackoverflow
  • Recent Posts

    • Работа с текстом во FreeBSD dos2unix, unix2dos, удаление BOM в консоли.
  • Categories

    • Atlassian
    • Bash
    • Bat-cmd
    • Bind
    • Blog
    • CentOS
    • Docker
    • Fedora
    • FreeBSD
    • Gitlab
    • Hardware
    • JavaScript
    • Linux
    • MacOSX
    • Mikrotik
    • PostgreSQL
    • Ubuntu
    • VCS
    • Windows
    • Zabbix
    • Zimbra

© 2013 Denis Kadyshev · Powered by pelican-bootstrap3, Pelican, Bootstrap

Creative Commons License Content licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where indicated otherwise.

Back to top