HI! All
Iam running this script ro split the file ,attact a timesatmp to it and then conver it to .tmp extension
cd /home/staff/thussain
Prefix=Z_PRICE_NEW_`date "+%Y%m%d%H%M%S"`
split -3000 -a 5 /home/staff/thussain/Z_PRICE_NEW.txt $Prefix
find . -name "$Prefix*" -print | {
while read FILE;
do
mv $FILE $FILE.tmp
done
}
out put
Z_PRICE_NEW_20070517014630aaaac.tmp
Z_PRICE_NEW_20070517014630aaaaa.tmp.tmp
but sone file are coming with tmp extension twice ,and any on tell me how to resolve this issue..
It seems like you are having left over files from previous splits.
The "split" command does not remove files prior to execution.
What I recommend you to do is to clean up the output split
files first before you issue the command:
I think if you eliminate the files having .tmp extension from the list of files into which you are looping, this problem will be solved. Code would be something like this,
cd /home/staff/thussain
Prefix=Z_PRICE_NEW_`date "+%Y%m%d%H%M%S"`
split -3000 -a 5 /home/staff/thussain/Z_PRICE_NEW.txt $Prefix
find . -name "$Prefix*" -print | grep -v '.tmp$' | {
while read FILE;
do
mv $FILE $FILE.tmp
done
}