【发布时间】:2014-01-08 08:44:32
【问题描述】:
我有一个名为 /input/temp 的文件夹。在文件夹里面我有很多文件。我需要找到模式Article_????_test_?????????.txt的文件并替换为下面的格式。
Article_????_?????????.txt
以下是我尝试过但不起作用的代码:
echo "Please provide the file name Corresponding to DC..."
read file
ls $HOME/*.txt | grep $file
if [ $? -eq 0 ]
find . $file '*_Test_*' -exec bash -c 'mv $0 ${0/_Test/ }' {} \;
if [ $? -eq 0 ]
find . $file -name "*.txt" -exec bash -c "mv {} \`echo {} | sed -e 's/[_TEST_]/_/g'\`" \;
then
我得到以下错误:
find: 0652-083 Cannot execute bash:: A file or directory in the path name does not exist.
find: 0652-083 Cannot execute bash:: A file or directory in the path name does not exist.
bash 无法在我的平台上执行。
【问题讨论】:
-
那你用的是什么shell?这是什么系统?