How could I replace a row of multiple txt files that would come from an output of ls -l?

Asked

Viewed 60 times

1

What I’d like to do is more or less that:

ls -l | xargs sed’s/regex of the pattern I want to replace/new data/g'

for each output of ls, a replacement is done inside the file using sed. Can you do it? There would be a more efficient way?

  • 1

    sed -i 's/dadosAntigos/novosDatas/g' *.txt ?

1 answer

0


I was able to find an alternative to edit all the files inside the directory:

sudo find . -type f -name "*. txt" | xargs sed -i "s/data"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.