Bonjour,
Voilà aujourd'hui, je cherche a faire un move de fichiers.
Vous allez me dire script basic, je sais ! Mais la ou le problème est , c'est que j'aimerais également renommé le fichier de destination avec le pid
=> $$.$FICHSOURCE = PID.FICHSOURCE
LOCATION= /data/se-MQSI/se-xf-in/EGTFCLIC.BEMVS001*
la ou j'aimerais qu on m'éclaire c'est au niveau du sed pour
FICHSOURCE= <s>/data/se-MQSI/se-xf-in/</s>EGTFCLIC.BEMVS001*
Est ce que cela est possible ?
ou faut-il utiliser une autre commande que sed ?
Merci d'avance pour votre précieuse aide
/data/se-MQSI/se-xf-in/EGTFCLIC.BEMVS001*@/data/se-MQSI/se-FROM-EGTF/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| #!/bin/ksh
#This script serves to move files
set -x
if [ "$1" = "" ]
then
echo "\033[41m "Parameter missing, please add the file with the destination and target list!"\033[m"
print "\n"
exit
fi
print "\n"
print "THE CONTENT OF THE LIST IS: \n\n$1"
print "\n"
#Prints the list content
param=`cat $1`
for file in $param
do
LOCATION=`echo $file | sed s/TO.*//g`
FICHORI=`echo $LOCATION |
echo "$FICHORI"
#picks everything before the TO
DESTINATION=`echo $file | sed s/.*TO//g`
FICHDEST=$$.$FICHORI
echo "$FICHDEST"
#picks everything after the TO
echo $LOCATION
echo will be moved to:
echo $DESTINATION
echo " \033[1m "You are moving files from "$LOCATION" to "$DESTINATION"" \033[m"
# mv $LOCATION $DESTINATION
#does the transfer from $LOCATION to the $DESTINATION
print "\n"
done
echo Script ended on `date`.
print "\n" |
Partager