2

I should do a script with sed command to replace any extensions of a file with the extension .bak.

hello.txt -> hello.bak

How can I do? I'm trying from command line with

echo hello.txt | sed -e s/\.[0-9a-b]+$/\.bak

But it doesn't change anything.

Andrea
  • 21

1 Answers1

0

For bash I have found some answers that might intrest you. This following question looks a lot like your question.

https://stackoverflow.com/questions/1224766/how-do-i-rename-the-extension-for-a-batch-of-files

In windows you can use the following: e.x

ren *.txt *.bat

this line changes the file extension of the file hello to .bat the * makes sure it selects every file with the extension .txt in the folder the cmd is openend and changes is to .bat

rrobben
  • 979