Bash трик (replace string)

Идеята е в една директория с 1000 файла да се замени стринга „RIBA“ с „KOSTUR“ и в место да се прави на ръка се прави с един ред:

find $PWD -type f -exec sed -i ‘s/RIBA/KOSTUR/g’ {} \;

find . -name ‘*.php’ -print0 |
xargs -0 -n 1 sed -i -e „s|OLD|NEW|g“

Категория:

Logged in as {{omniform_current_user_display_name}}. Edit your profile. Log out? Required fields are marked *

Your email address will not be published. Required fields are marked *

Comments are closed.

You must be logged in to post a comment.