I have to make a one-liner that renames all files in the current directory that end in ".hola" to ".txt".
For example:
sample.hola and name.hi.hola
will be renamed to sample.txt
and name.hi.txt
respectively
I was thinking about something like:
ls -1 *.hola | awk '{NF="";print "$0.hola $0.txt"}'
(*)
And then passing the stdin to xargs mv -T
with a |
But the output of (*) for the example would be sample
and name hi
.
How do I get the output name.hi
for name.hi.hola
using awk
?