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
set_color(1)                                                           fish                                                           set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 09:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy