Sponsored Content
Top Forums Shell Programming and Scripting Rsync script to rewrite suffix - BASH, awk, sed, perl? Post 302783511 by jmituzas on Wednesday 20th of March 2013 03:04:39 PM
Old 03-20-2013
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 Smilie

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 Smilie
still not rewriting as I would like rewrote as "test1.txt.20130320 95325.~"

Last edited by jmituzas; 03-20-2013 at 04:11 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script to back up with rsync

I'm trying to write a script to back up with rsync, the script I am posting below: nomServer="shiva horus isis" dirshiva="/etc /faturamento" shivaListExc="/usr/local/bin/shivaListExclRsync" dumpDir="$dumpFile/Shiva" dateBkp=`date +%A` for nServer in ${nomServer} do ... (3 Replies)
Discussion started by: ajmoreti
3 Replies

2. Shell Programming and Scripting

SED to add a suffix

Hi all, Im trying to make a proper hosts.allow with the lists of sshbl.org to block the ssh brute force attackers. The list is a text file with an IP on every line. What I've gotten up sofar is to prefix "sshd : " on every line, but I need a " : deny" suffix behind every line as well. ... (9 Replies)
Discussion started by: necron
9 Replies

3. Shell Programming and Scripting

XML- Sed || Awk Bash script... Help!

Hi ! I'm working into my first bash script to make some xml modification and it's going to make me crazy lol .. so I decide to try into this forum to take some ideas from people that really know about this! This is my situation I've and xml file with a lots of positional values with another tags... (9 Replies)
Discussion started by: juampal
9 Replies

4. Shell Programming and Scripting

'Couldn't read file' error in bash script with expect, sed and awk!

Ok, so I have a bash script with an embedded expect statement. Inside of the expect statement, i'm trying to pull all of the non-comment lines from the /etc/oratab file one at a time. Here's my command: cat /etc/oratab |sed /^s*#/d\ | awk 'NR==1'|awk -F: '{print \"$1\"}'|. oraenv Now,... (0 Replies)
Discussion started by: alexdglover
0 Replies

5. Shell Programming and Scripting

Date as suffix in rsync... what am I doing wrong?

#!/bin/bash currentdatee=$(date +%D-%R) rsync -autb --backup-dir="/home/kyle/USBSYNC/OLDFILES/CRUZEREDGE1/" --suffix="$currentdatee" /mnt/backup/* /home/kyle/USBSYNC/CRUZEREDGE1/ The rsync line simply doesn't work when I try this. It'll work if I make the suffix something static. I feel... (1 Reply)
Discussion started by: corrado33
1 Replies

6. Shell Programming and Scripting

Help to rewrite scritp Bash into a batch

Hello, My Bash script is working but i dont know batch programing, anyone can help me? I dont want use programs to do this task, i will use in many computers... Bash: My work until now... BATCH: Thanks for help. (1 Reply)
Discussion started by: Rodrocha
1 Replies

7. Shell Programming and Scripting

Search strings and highlight them using Perl or bash/awk/sed

Hi, I have two files: a.doc and b.txt I wish to search the strings from file b.txt in a.doc and want to highlight them in a.doc with different colours using Perl or bash./awk/sed? Please guide me. :) Thanks!!!!! (10 Replies)
Discussion started by: bioinfo
10 Replies

8. Shell Programming and Scripting

Rewrite sed to perl or run sed in perl

I am having trouble re-writing this sed code sed -nr 's/.*del(+)ins(+).*NC_0{4}(+).*g\.(+)_(+).*/\3\t\4\t\5\t\1\t\2/p' C:/Users/cmccabe/Desktop/Python27/out_position.txt > C:/Users/cmccabe/Desktop/Python27/out_parse.txt in perl Basically, what the code does is parse text from two fields... (12 Replies)
Discussion started by: cmccabe
12 Replies

9. Shell Programming and Scripting

Text manipulation with sed/awk in a bash script

Guys, I have a variable in a script that I want to transform to into something else Im hoping you guys can help. It doesn't have to use sed/awk but I figured these would be the simplest. DATE=20160120 I'd like to transform $DATE into "01-20-16" and move it into a new variable called... (8 Replies)
Discussion started by: dendenyc
8 Replies

10. Shell Programming and Scripting

awk script to append suffix to column when column has duplicated values

Please help me to get required output for both scenario 1 and scenario 2 and need separate code for both scenario 1 and scenario 2 Scenario 1 i need to do below changes only when column1 is CR and column3 has duplicates rows/values. This inputfile can contain 100 of this duplicated rows of... (1 Reply)
Discussion started by: as7951
1 Replies
gather_stx_titles(1)					      General Commands Manual					      gather_stx_titles(1)

NAME
gather_stx_titles - gather title declarations from Stx documents SYNOPSIS
gather_stx_titles [ -f from-suffix ] [ -t to-suffix ] [ m4 options ] file [ file ... ] DESCRIPTION
gather_stx_titles digs out Stx metadata declarations from the listed files, and dumps the title and document ID information as m4 defini- tions into standard output. This information can later be used by w_crosslink to link the documents by their metadata. Why is this useful? Well, imagine that you have a large site with a lot of cross-linking. A document's name will appear in many places: in the link menu (if you have one), and in the body of different pages where it is cross-linked from. gather_stx_titles lets you put all the information in one place and where it belongs, i.e. the file itself. You'll be glad if you did, when the time comes to change document titles or move the documents around; especially so if your website has multilingual magic. OPTIONS
gather_stx_titles uses m4 internally and will accept any option m4 accepts. In addition to those, it takes the following options: -f from-suffix In the filename data, substitute away the suffix from-suffix. Actually, from_suffix may be a regular expression; stupid but true, in GNU m4 it is a "traditional" regexp, whereas in BSD m4 it is an "extended" regexp. Default to no suffix (nothing to take away). -t to-suffix In the filename data, substitute the suffix taken away by from-suffix with to-suffix. If from-suffix is nil (the default), append to-suffix to all filenames. -p prefix Strip away the prefix given by (regular expression) prefix from filenames. The equivalent of -t for this does not exist, because you can specify a directory prefix to w_crosslink by w_base. --version, -V Just show version information and exit. --help, -? Just show a short help message and exit. EXAMPLES
I guess most of the time you will want to automate the use of gather_stx_titles, for example with a Makefile like this: SOURCES = $(wildcard *.stx) TARGETS = $(SOURCES:.stx=.html) all: $(TARGETS) titles.m4: $(SOURCES) gather_stx_titles -f stx -t html $^ > $@ %.html: %.stx titles.m4 stx2any -T html titles.m4 $< > $@ If you don't want to be quite so correct, drop the .html dependency on titles.m4 or titles.m4 dependency on SOURCES. Using temporary files is not necessary: this should also work: $ gather_stx_titles *.stx | stx2any - mydoc.stx SEE ALSO
stx2any (1). AUTHOR
This page is written by Panu A. Kalliokoski. Panu A. Kalliokoski gather_stx_titles(1)
All times are GMT -4. The time now is 03:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy