I need help on renaming files using awk or sed please
I need help on renaming files using awk or sed please
(OP)
I have a list of files with a file structure as below:-
07(year)+11(month)+19(day of the month)+24(hour)+10(minutes)+55(seconds)+afilenameanylength.txt
I need to rename the file so I get rid of the 07(year)+11(month)+19(day of the month)+24(hour)+10(minutes)+55(seconds) and rename it to afilenameanylength.txt
e.g ls *.txt | awk '{print "mv" $1, substr($1,13,25)}'
Can anyone help please, it will be most appreciated.
Many thanks in advance.
07(year)+11(month)+19(day of the month)+24(hour)+10(minutes)+55(seconds)+afilenameanylength.txt
I need to rename the file so I get rid of the 07(year)+11(month)+19(day of the month)+24(hour)+10(minutes)+55(seconds) and rename it to afilenameanylength.txt
e.g ls *.txt | awk '{print "mv" $1, substr($1,13,25)}'
Can anyone help please, it will be most appreciated.
Many thanks in advance.

Talk To Other Members
RE: I need help on renaming files using awk or sed please
CODE
but it's kind of dangerous because you may end up overwriting a lot of files that once had a unique name...
Therefore, a trial run:
CODE
HTH,
p5wizard
RE: I need help on renaming files using awk or sed please
CODE
for file in *.txt
do
mv $file ${file##[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]}
done
Ceci n'est pas une signature
Columb Healy
RE: I need help on renaming files using awk or sed please
I now get this
echo cp 000008522130127cl 000008522130127cl .csv
I need to get rid of the space between second file name and the .csv
any clues.
I used this syntaxls * | awk '{print "echo cp", $1, $1,".csv"}'> filename
so it reades:-
echo cp 000008522130127cl 000008522130127cl.csv
RE: I need help on renaming files using awk or sed please
HTH,
p5wizard