rename data fiels

This commit is contained in:
6543 2019-09-11 01:18:10 +02:00
parent 4aa4383da3
commit d6330f5382
Signed by: 6543
GPG Key ID: A1CA74D27FD13271
5 changed files with 11 additions and 11 deletions

View File

View File

2
cp_sh
View File

@ -7,7 +7,7 @@ function free_disk() {
df "$1" | tail -n1 | sed -r -e "s/[\t\ ]+/ /g" | cut -d ' ' -f 4 df "$1" | tail -n1 | sed -r -e "s/[\t\ ]+/ /g" | cut -d ' ' -f 4
} }


md5="2cp" md5="2cp.md5"
aim="/mnt/export/transport" aim="/mnt/export/transport"





14
select
View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
#wenn delete file exits -> handle deletons (importand for konflict handling #wenn delete file exits -> handle deletons (importand for konflict handling
[ -f 2rm ] && { [ -f 2rm.md5 ] && {
cat 2rm | cut -c -32 | while read line; do cat 2rm.md5 | cut -c -32 | while read line; do
sed -i "/$line/d" vorhanden sed -i "/$line/d" vorhanden
done done
cat 2rm | cut -c 35- | while read line; do cat 2rm.md5 | cut -c 35- | while read line; do
l=$(grep " $line"$ vorhanden) l=$(grep " $line"$ vorhanden)
[ -n "$l" ] && { [ -n "$l" ] && {
echo $l echo $l
@ -12,20 +12,20 @@
sed -i "/$md5/d" vorhanden sed -i "/$md5/d" vorhanden
} }
done done
rm 2rm rm 2rm.md5
} }


#gleiche dateien anhand md5 aussortieren #gleiche dateien anhand md5 aussortieren
cat vorhanden | cut -c -32 | while read line; do sed -i "/$line/d" 2cp ; done cat vorhanden | cut -c -32 | while read line; do sed -i "/$line/d" 2cp.md5 ; done


#dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln #dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln
echo Konflicts: echo Konflicts:
echo echo
cat vorhanden | cut -c 35- | while read line; do cat vorhanden | cut -c 35- | while read line; do
l=$(grep " $line"$ 2cp | tee -a konflicts) l=$(grep " $line"$ 2cp.md5 | tee -a konflicts)
[ -n "$l" ] && { [ -n "$l" ] && {
echo $l echo $l
md5=$(echo $l | cut -c -32) md5=$(echo $l | cut -c -32)
sed -i "/$md5/d" 2cp sed -i "/$md5/d" 2cp.md5
} }
done done

View File

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash


md5=$1 md5="$1"
[ -z "$md5" ] && md5=2cp [ -z "$md5" ] && md5=2cp.md5
[ -f "$md5" ] || { echo "ERROR: $md5 not found"; exit 255; } [ -f "$md5" ] || { echo "ERROR: $md5 not found"; exit 255; }


function calc_kb() { function calc_kb() {
i=0 i=0
cat $1 | cut -c 34- | while read line; do cat "$1" | cut -c 34- | while read line; do
kb=$(du "$line" | cut -f 1) kb=$(du "$line" | cut -f 1)
i=$((i+kb)) i=$((i+kb))
echo $i echo $i