How do I replace text with perl with a list fo files?
Hello
I want to replace "root" to "tux" in all the files in some directory. I get them by using tree: Code:
$ tree -af --noreport -i How do I list only files and not directories? There is -d for only directories |
Quote:
Code:
$ tree -af --noreport -i | perl -pi -e "s/root/tux/g;" Quote:
This will find all files that aren't directories (including symbolic links, fifos, device files, etc): Code:
$ find -not -type d Code:
$ find -type f |
thanks, but it's not work with perl:
Code:
$ find -type f|perl -pi -e "s/root/tux/g;" |
How is what you just posted not working? It looks like exactly what you asked for.
Could you tell me what output you expected? |
It's not replace the content between root to tux.
Code:
$ cat a |
Quote:
|
I need that it replace the files itself.
Why doesn't it replace? |
how about sed?
find -type f -exec sed -i -e 's/tux/root/' {} \; worked for me |
All times are GMT -5. The time now is 11:10 AM. |