Given file path such as fiz.js and dir/buz.js, how to remove suffixes to obtain fiz dir/buz?
My best shot (I’m looking for something simpler):
find -name '*.js'| \
xargs -I{} echo {} | \
sed 's/.js$//' | \
xargs -I{} mv {}.js {}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could do it with just
bash(version 4) by usingglobstarto get a recursive file list.For the bash man page:
${x%ext}removesextfrom the end of$x. See String manipulations for more.