Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Move the files between Current day & a previous day Post 302651501 by dsfreddie on Wednesday 6th of June 2012 12:28:16 PM
Old 06-06-2012
Hi Frappa,

Here is the log I am seeing after executing the script.

++ grep P_BUS_DATE
++ cut -d= -f2
+ export BUS_DATE=20120528
+ BUS_DATE=20120528
++ date +%Y%m%d
+ CURR_DY=20120605
++ date --date=20120605 +%s
+ CURR_DY_SECS=1338872400
++ date --date=20120528 +%s
+ BUS_DATE_SECS=1338181200
++ 8
script.ksh: line 31: 8: command not found
+ DAYS=
+ i=
+ '$DAYS'
scripts.ksh: line 33: $DAYS: command not found
+ '[' -ge 0 ']'
scripts.ksh: line 34: [: -ge: unary operator expected

Can you pls shed some light.

Thanks Much
Freddie

---------- Post updated 06-06-12 at 12:28 PM ---------- Previous update was 06-05-12 at 03:52 PM ----------

Hi All,

I made some improvements in the issue below,

Here is the error I am getting now,

Quote:
++ grep P_BUS_DATE
++ cut -d= -f2
+ export BUS_DATE=20120528
+ BUS_DATE=20120528
++ date +%Y%m%d
+ CURR_DY=20120606
++ date --date=20120606 +%s
+ CURR_DY_SECS=1338958800
++ date --date=20120528 +%s
+ BUS_DATE_SECS=1338181200
+ DAYS=9
+ i=9
+ [[ 9 -ge 0 ]]
++ expr 20120606 - 9
+ mv /path/filename.20120597.dat /iis_dev_data/wcc/cpmg/ctl/
mv: cannot stat `/path/filename.20120597.dat': No such file or directory
+ i=8
+ [[ 8 -ge 0 ]]
++ expr 20120606 - 8
+ mv //path/filename.20120598.dat /iis_dev_data/wcc/cpmg/ctl/
mv: cannot stat `/path/filename.20120598.dat': No such file or directory
+ i=7
+ [[ 7 -ge 0 ]]
++ expr 20120606 - 7
Any thoughts are appreciated

Thanks,
Freddie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete files one day old in current month only

i want to delete files that are one day old condition is files should be of current month only ie if iam running script on 1 march it should not delete files of 28 feb(29 if leap year :-)} any modifications to find $DIR -type f -atime +1 -exec rm -f{}\; (4 Replies)
Discussion started by: maverick
4 Replies

2. Shell Programming and Scripting

Download previous day files through FTP

Hi All, I have a scenario where I need to download the previous day modified files from other server to my server through FTP . Could any one please send me the shell script for the same. I used the following but I dont know how to proceed after this. ftp -n -i -v $IP <<ENDOFinPUT >>... (3 Replies)
Discussion started by: sarathchandrach
3 Replies

3. UNIX for Dummies Questions & Answers

sample script to archive & move previous day syslog files

hi all. Please help me with archiving previous day syslog files. the files have no extension and have the format YYYY-MM-DD. I want to archive the file then move it to some other machine. thanks. (2 Replies)
Discussion started by: coolatt
2 Replies

4. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

5. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

6. Shell Programming and Scripting

Command to list current day files only

Hi All, can anyone pls share the command to list the files of current day only. i want to check if there are any files in a particular directory which are not of current date. (6 Replies)
Discussion started by: josephroyal
6 Replies

7. UNIX for Dummies Questions & Answers

current day remote files from FTP

Hi All, I have to work on a korn shell script to pick up only the current day files dropped on the remote server (using ftp). The file do not have daytimestamp on it. It has to be based on server time (AIX) The file naming convention is "test_file.txt" When I log in into the ftp account... (15 Replies)
Discussion started by: pavan_test
15 Replies

8. UNIX for Dummies Questions & Answers

List the files of previous day

I am using KSH. d=date | nawk '{ print $2,$3-1}' ls -lrt SystemOut* | nawk '/d/{print $NF}' I am trying to list the files of previous day but it doesn't seem to be working and i am also not getting an error. result is blank.Need help. (11 Replies)
Discussion started by: vagar11
11 Replies

9. UNIX for Dummies Questions & Answers

How to save current day files only?

i want to save current day file daily for this is am using below command. cp -p $(ls -lrt | grep "Apr 15" | awk '{print $9}' in order to script this part, i am saving date output in a file using below command date | awk '{print $2,$3}' >>t1 thru below command i want to list the file of... (7 Replies)
Discussion started by: scriptor
7 Replies

10. UNIX for Beginners Questions & Answers

How to get first & last day of a month from current date?

Hi, I need the first & last day of a month from any given date. For better understanding, if i need to back-fill data for date 07/20/2019 i.e July 20 2019, i need the first & last day has 07/01/2019 - 07/31/2019. FYI: I'm using GIT BASH terminal. sample code: export DT=$(date --date='6 days... (2 Replies)
Discussion started by: Rocky975583
2 Replies
NNSTATS(1m)															       NNSTATS(1m)

NAME
nnstats - display nnmaster collection and expire statistics SYNOPSIS
nnstats [ -lt ] [ -d month day ] [ -m month ] [ logfile ]... DESCRIPTION
nnstats will extract the collection (C) and expiration (X) entries from the log file and calculate total and average number of articles, groups and elapsed time per day, per month, or for the duration of the whole log file. Normally only a summary for the specified period is printed. If -l is specified, the statistics for each day in the period is also printed, and if -t is specified the summary is not printed. Normally the statistics is collected for all days in the log files (or the current log file if one is not specified). If "-m month" is specified, the statistics for that month is calculated. The month is specified in normal date notation, i.e. a capital- ized three letter abbreviation like Jan, Feb, ... If "-d month day" is specified, the statistics for that date only is calculated and printed. FILES
../Log The log file SEE ALSO
nn(1), nnusage(1M), nnadmin(1M), nnmaster(8) NOTES
If nnmaster is run with options -LCX, nnstats will not work, because the necessary entries are not written to the log file. AUTHORS
Mark Moraes <moraes@csri.toronto.edu> Kim F. Storm <storm@texas.dk> 4th Berkeley Distribution Release 6.6 NNSTATS(1m)
All times are GMT -4. The time now is 10:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy