Sponsored Content
Full Discussion: AWS S3 with Bash Script
Top Forums Shell Programming and Scripting AWS S3 with Bash Script Post 302936907 by RavinderSingh13 on Monday 2nd of March 2015 01:05:49 AM
Old 03-02-2015
Quote:
Originally Posted by krux_rap
Hello All,

I am trying few stuff on Amazon S3 move files to EC2 (Ubuntu Server)

I am receiving daily 2 files in S# bucket

Code:
XYZ_2015-02-26_ 200.csv
ABC_2015-02-26_ 200.csv

I want to move daily received files to local EC2(Ubuntu server) and rename files to
Code:
XYZ_2015-02-26.csv
ABC_2015-02-26.csv

Instead of Renaming files after moving to EC2 , if possible i want to rename files on S3 itself.

and send an email notification with files received or not on daily basis

Is this possible using Bash? If yes, please guide.

Thanks
Krux
Hello Krux_rap,

Could you please try following.
Code:
ls -lhtr *200.csv | awk '{A=$(NF-1);gsub(/\_/,X,$(NF-1));print "mv " A $NF OFS $(NF-1)".csv"}'

It will print only the move command with new file and old file names, if happy with results you can try following.
Code:
ls -lhtr *200.csv | awk '{A=$(NF-1);gsub(/\_/,X,$(NF-1));print "mv " A $NF OFS $(NF-1)".csv"}' | sh

Thanks,
R. Singh
 

4 More Discussions You Might Find Interesting

1. Virtualization and Cloud Computing

Computing in the Clouds with AWS

Tim Bass 07-25-2008 02:34 AM The admin*team at The UNIX Forums*have been considering moving the UNIX and*Linux*Forums to the clouds - the Amazon Web Services (AWS) cloud.* Amazon EC2 is one option to scale the forums, which is a*LAMP application.* Amazon EC2 allows*us to rent dedicated... (3 Replies)
Discussion started by: Linux Bot
3 Replies

2. Virtualization and Cloud Computing

How to grow an EBS Array at AWS

This process was collected by trial and error (mostly error) since most of the documents I found on the 'net were incomplete. The cookbook/walkthrough on how to grow an Array on EBS at AWS... # walkthrough by John Jones (jjones at cirrhus9 dot com) umount /dev/md0 mdadm --stop /dev/md0... (0 Replies)
Discussion started by: Habitual
0 Replies

3. Shell Programming and Scripting

AWS Cloud EBS limit script!

Hi, I am trying to correct the following script to get total EBS usage from Amazon cloud. Can someone please help in correcting it. It appears that its not working properly. t=0; for i in `ec2-describe-volumes | grep VOLUME | grep standard | awk '{print $3}'`; do t=`expr $t + $i`; done;... (2 Replies)
Discussion started by: amar0000
2 Replies

4. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
SYSSTAT(5)							Linux User's Manual							SYSSTAT(5)

NAME
sysstat - sysstat configuration file. DESCRIPTION
This file is read by sa1(8) and sa2(8) shell scripts from the sysstat's set of tools. It consists of a sequence of shell variable assign- ments used to configure sysstat logging. The variables and their meanings are: HISTORY The number of days during which a daily data file or a report should be kept. Data files or reports older than this number of days will be removed by the sa2(8) shell script. COMPRESSAFTER Number of days after which daily data files are to be compressed, either by gzip or bzip2. SADC_OPTIONS Options that should be passed to sadc(8). With these options (see sadc(8) manual page), you can select some additional data which are going to be saved in daily data files. These options are used only when a new data file is created. They will be ignored with an already existing one. FILES
/etc/sysstat/sysstat AUTHOR
Sebastien Godard (sysstat <at> orange.fr) SEE ALSO
sadc(8), sa1(8), sa2(8) http://pagesperso-orange.fr/sebastien.godard/ Linux SEPTEMBER 2010 SYSSTAT(5)
All times are GMT -4. The time now is 11:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy