Removing characters from file name
Good evening. I need to remove letters from filenames up to and including the "-":
example:
ne-swickdnv.txt
south-windsexto.txt
westcomp-hawk22.txt
there are a variable number of characters before the "-". The output should be:
swickdnv.txt
windsexto.txt
hawk22.txt
I have tried to use sed
for file in *.txt;
do
sed 's/*-//g' $file >tempfile
mv tempfile $file
done
of course this did not work or I would not be here. I have tried several variations with no luck. I am sure it is because I do not understand the correct use of the wildcard in the sed command but I cannot find anything on this. All examples I have found remove a set number of charaters or deal with spaces.
Thanks for the time.
Chris
|