Skip to content

Instantly share code, notes, and snippets.

@MeenachiSundaram
Created November 14, 2016 10:25
Show Gist options
  • Select an option

  • Save MeenachiSundaram/9b70145eeedcd8580dd592eef5d6dd75 to your computer and use it in GitHub Desktop.

Select an option

Save MeenachiSundaram/9b70145eeedcd8580dd592eef5d6dd75 to your computer and use it in GitHub Desktop.
script to read file with names and rename it
#!/bin/bash
#name=($@)
name=(`cat file`)
for (( i=0;i<${#name[@]}; i++ ))
do
touch ${name[$i]}
if [ $? -eq 0 ]; then
rename=$(sed 's/-/_/g' <<< ${name[$i]} )
echo $rename
mv ${name[$i]} $rename.tar
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment