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
PROCESSCSV.PY(1)					      Virtualization Support						  PROCESSCSV.PY(1)

NAME
processcsv.py - process virt-top CSV files SUMMARY
virt-top --csv data.csv processcsv.py < data.csv DESCRIPTION
virt-top is a top(1)-like utility for showing stats of virtualized domains. processcsv.py is a simple Python script that post-processes the output of "virt-top --csv". It is used like this: virt-top --csv data.csv processcsv.py < data.csv The second command will overwrite the following files in the current directory: "global.csv" This contains the global (host) statistics columns from the CSV file. "domainNN.csv" (multiple files) For each libvirt domain ID NN, a file is created containing the per-domain statistics from the CSV file. SEE ALSO
virt-top(1) AUTHORS
Richard W.M. Jones <rjones @ redhat . com> COPYRIGHT
(C) Copyright 2007-2012 Red Hat Inc., Richard W.M. Jones http://libvirt.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. virt-top-1.0.8 2013-12-29 PROCESSCSV.PY(1)
All times are GMT -4. The time now is 09:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy