×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Rsync script to rewrite suffix - BASH, awk, sed, perl?

Tags
awk, bash, rsync, sed

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-20-2013
jmituzas jmituzas is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 20 March 2013, 3:41 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rsync script to rewrite suffix - BASH, awk, sed, perl?

trying to write up a script to put the suffix back.
heres what I have but can't get it to do anything

would like it to be name.date.suffix



Code:
rsync -zrlpoDtub --suffix=".`date +%Y%m%d%k%M%S`.~" --bwlimit=1024  /mymounts/test1/ /mymounts/test2/



Code:
while IFS=. read -r -u 9 -d '' name suffix date tilde
do
    mv "${name}.${suffix}.${date}.~" "${name}.${date}.${suffix}"
done 9< <(find . -type f -name "*.~" -print0)



Code:
   rsync -zrlpoDtub --suffix=".`date +%Y%m%d%k%M%S`.~" --bwlimit=1024  /mymounts/test2/ /mymounts/test1/



Code:
while IFS=. read -r -u 9 -d '' name suffix date tilde
do
    mv "${name}.${suffix}.${date}.~" "${name}.${date}.${suffix}"
done 9< <(find . -type f -name "*.~" -print0)

Thanks in advance,

---------- Post updated at 03:04 PM ---------- Previous update was at 02:49 PM ----------

receiving error:



Code:
rsync: link_stat "/RsyncScripts/94646.~" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
rsync: link_stat "/RsyncScripts/94647.~" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]

Fixed that error was an error in rsync syntax
still not rewriting as I would like rewrote as "test1.txt.20130320 95325.~"

Last edited by jmituzas; 03-20-2013 at 03:11 PM..
Sponsored Links
    #2  
Old 03-26-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 February 2016, 3:35 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,673
Thanks: 8
Thanked 588 Times in 561 Posts
What is the current command and output?
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help to rewrite scritp Bash into a batch Rodrocha Shell Programming and Scripting 1 10-19-2012 11:12 AM
Date as suffix in rsync... what am I doing wrong? corrado33 Shell Programming and Scripting 1 10-07-2012 10:57 PM
'Couldn't read file' error in bash script with expect, sed and awk! alexdglover Shell Programming and Scripting 0 09-20-2012 09:49 PM
XML- Sed || Awk Bash script... Help! juampal Shell Programming and Scripting 9 08-28-2011 03:36 PM
Bash script to back up with rsync ajmoreti Shell Programming and Scripting 3 11-16-2009 05:36 AM



All times are GMT -4. The time now is 02:28 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.