smalig
asked on
truncate file names in Linux from a shell program
Hi Experts,
I have a bunch of files in a folder in a linux system which have names like
10.20.20.122_334 -showcerts
10.22.23.223_8080 -showcerts
I just need the files in the names -- 10.20.20.122_334 (without the -showcerts)
how do I rename the files or move the files to a new folder like I want?
I have a bunch of files in a folder in a linux system which have names like
10.20.20.122_334 -showcerts
10.22.23.223_8080 -showcerts
I just need the files in the names -- 10.20.20.122_334 (without the -showcerts)
how do I rename the files or move the files to a new folder like I want?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for i in `ls *showcerts`; do n=`echo $i | cut -d- -f1`; mv -v $i newfolder/$n; done