My apologies...
It is SunOS...and using ksh...
Sorry there is no GNU
---------- Post updated 06-19-13 at 10:32 AM ---------- Previous update was 06-18-13 at 07:17 PM ----------
I assume there is no such FTP command that gives me only the most recent file..
To get the work done, I have created a log file which contains the dir's output as shown:
Code:
Connected to XXX.XXX.XXX.XXX.
220 EFT Server 6.4.10 Build XX.XX.XXXX.X
331 Password required for XXXXX.
230 Login OK. Proceed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 250 Folder changed to "/XX/XXXXXXX/XXXX/XXXX".
ftp> 200 Command okay.
150 Opening ASCII mode data connection for file list.
-rw-rw-rw- 1 user group 8031232 Apr 13 2010 A100323.xls
-rw-rw-rw- 1 user group 9041408 Jun 30 2010 A100628.xls
-rw-rw-rw- 1 user group 4178690 Sep 30 2012 A100929.xlsx
-rw-rw-rw- 1 user group 1800395 Dec 30 2010 A101230.xlsx
-rw-rw-rw- 1 user group 1526971 Mar 31 2011 A110330.xlsx
-rw-rw-rw- 1 user group 1789926 Sep 19 2011 A110630.xlsx
-rw-rw-rw- 1 user group 2068925 Sep 13 2011 A110919.xlsx
-rw-rw-rw- 1 user group 1945225 Sep 30 2011 A110929.xlsx
-rw-rw-rw- 1 user group 1213118 Dec 30 2012 A111230.xlsx
-rw-rw-rw- 1 user group 3449169 Feb 13 2012 A120213.xlsx
-rw-rw-rw- 1 user group 8917313 Mar 30 2012 A120330.xlsx
-rw-rw-rw- 1 user group 1323563 Jun 28 2012 A120626.xlsx
-rw-rw-rw- 1 user group 1517358 Jan 27 2012 A120927.xlsx
-rw-rw-rw- 1 user group 1926533 Dec 21 2012 A121231.xlsx
226 Transfer complete. 964 bytes transferred. 964 bps.
964 bytes received in 0.00022 seconds (4316.40 Kbytes/s)
ftp> 221 Service closing control connection.
Then I replaced Jan with 1, Feb with 2 and so on... this part of script I have written in scr file and execute it like ./scr. Output of scr is piped to below commands to get the most recent file name... scr also contains grep '^-.*xlsx$' to get only the required rows from log file...
OK, I know next to nothing about scripting in unix, and at the moment I don't have access to a unix environment...
We have an application that generates a text report file which is later printed. The format is this:
bbtptcYYMMDDSSCC.txt (year/month/day/second/check digit)
I want a... (1 Reply)
I need to change the name of a file within a script. For example I have two files. The first named scrnslc_0001 and the second scrnslc_0002. I want to change the name of the second to scrnslc_out. The appended number will change, and I won't know the file name in advance. If there were only one... (1 Reply)
Hi,
I have files coming in every day with that days timestamp like:
nameyyyymmddhhmmss.ext.
I need the most recent one and so i am using
cat `ls -t name*|head -1 ` > temp
i am sorting the files in the decending order and am copying the most recent one into a temp file.
It works at times... (3 Replies)
Hi All,
Here is a brief scenario for my requirement ..
There is a directory in FTP Server, where would files be uploaded on weekly basic.
I need to get those files which are uploaded during this week and not the files which are uploaded the previous week and download them to locale... (1 Reply)
I have only been working with Linux for a few years now so bear with my noob question. I was wondering if there is a way to tail the most recent file that has a file name like 'scrubsncoa%'. There will be at least 2 files in the directory that start with 'scrubsncoa' and a few other different... (2 Replies)
Hi people,
Please some help over here.
I have logs in a directory, in which I need to get the most recent file in order to put it within other command.
The format of the files are
loadfiles20090308094339_41
loadfiles20090308094418_42
loadfiles20090308095457_43... (4 Replies)
I am trying to write a script to ftp all files/directories changed in a 24hour period to another AIX server. I have wrote a script to generate a list of all files changed within a 24 hour period but dont know how to then ftp these to another server. How do incorporate ftp into this script?
... (2 Replies)
How do you get your recent vi command history to show up? I keep randomly getting like my previous 5 commands and can't figure out how I'm doing it. I think it has something to do with the shift key and another button. (6 Replies)
Hi,
Here is my problem:
I try to write a script to find data in a file named "data" for exemple.
Let's say I am in the directory /x/y/z, there are several sub-directories in the "z" directory (each sub-directory has a file "data") and I am searching for the word "help".
So I use this... (9 Replies)
Dear,
Require a script to check :
If the file under /opt/OV/log directory has recent 5 hours(or user defined value) file generated or not
If generated then cmd to call :
opcmsg a=a o=o msg_grp=OpC msg_text="Log file didn't generated on $time" s=critical (1 Reply)