#!/bin/bash
file="/home/BILEKJ/Reprocess/data.txt"
while IFS= read -r line
do
mv "/home/BILEKJ/Reprocess/EDI855/$line" "/home/BILEKJ/Reprocess/Final855" >/dev/null 2>&1
done <"$file"
当我运行此命令时,没有错误,但文件未移动到目标位置。
我的输入文件名如下
PFZ_EDI855_MLC_JKC_ORDER_ACKNOWLEDGEMENT_20170328163787216.TXT--31823595
PFZ_EDI855_MLC_JKC_ORDER_ACKNOWLEDGEMENT_20170328190687220.TXT--31831795
PFZ_EDI855_MLC_JKC_ORDER_ACKNOWLEDGEMENT_20170328191687221.TXT--31831983
PFZ_EDI855_MLC_JKC_ORDER_ACKNOWLEDGEMENT_20170329091787222.TXT--31872252
答案1
尝试使用这个命令:
cat $file | xargs -i{} mv /home/BILEKJ/Reprocess/EDI855/{} /home/BILEKJ/Reprocess/Final855