We are find the file name shashi_kant and Rename to shashi-kant.
#!/bin/bash
FILE1=shashi_kant
PATH1=/home/shashi/R0_data
if [ 0 == 0 ]; then
A=$(ls -l $PATH1 | grep -i $FILE1 | awk {'print $9'} > /tmp/R0_shashi)
for file in `cat /tmp/R0_shashi`
do
B=$(echo $file | tr '[:lower:]' '[:upper:]')
C=$(mv $PATH1/$file $PATH1/$B) ### CAPITAL
done
fi
if [ 0 == 0 ]; then
B=$(ls -l $PATH1 | grep -i $FILE1 | awk {'print $9'} > /tmp/R0_shashi1)
for file1 in `cat /tmp/R0_shashi1`
do
D=`mv $PATH1/$file1 $PATH1/${file1/${file1:6:1}/-}`; ## rename file
done
fi
#!/bin/bash
FILE1=shashi_kant
PATH1=/home/shashi/R0_data
if [ 0 == 0 ]; then
A=$(ls -l $PATH1 | grep -i $FILE1 | awk {'print $9'} > /tmp/R0_shashi)
for file in `cat /tmp/R0_shashi`
do
B=$(echo $file | tr '[:lower:]' '[:upper:]')
C=$(mv $PATH1/$file $PATH1/$B) ### CAPITAL
done
fi
if [ 0 == 0 ]; then
B=$(ls -l $PATH1 | grep -i $FILE1 | awk {'print $9'} > /tmp/R0_shashi1)
for file1 in `cat /tmp/R0_shashi1`
do
D=`mv $PATH1/$file1 $PATH1/${file1/${file1:6:1}/-}`; ## rename file
done
fi
No comments:
Post a Comment