FTP Log File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP Log File
# 1  
Old 10-22-2012
FTP Log File

Hello,

I need help to check content of ftp log files. I forgot to say that I am on Solaris 9. I am using KSH.

I have 2 log files.

Here is an example of content :

LOG File from 21 October

Code:
-rw-rw-r--  1 cvbntr  xarf  94974 Nov  1  2009 TAG__SC___2006175_0.TAB
-rw-rw-r--  1 cvbntr  xarf  94974 Nov  1  2009 TAG__SC___2006175_0.HDR
-rw-rw-r--  1 cvbntr  xarf   3563 May  8 04:07 TAG__KSM__2012063_0.HDR
-rw-rw-r--  1 cvbntr  xarf   3585 May  8 04:07 TAG__KSO__2012063_0.HDR
-rw-rw-r--  1 cvbntr  xarf  95106 Aug 31 12:56 MAG__KSO__2012171_0.TAB
-rw-rw-r--  1 cvbntr  xarf   3647 Aug 31 12:56 MAG__KSO__2012171_0.HDR
-rw-rw-r--  1 cvbntr  xarf  83424 Oct 21 02:41 TAG__SC___2012230_0.TAB
-rw-rw-r--  1 cvbntr  xarf   3602 Oct 21 02:41 TAG__SC___2012230_0.HDR

LOG File from 22 October

Code:
-rw-rw-r--  1 cvbntr  xarf  95974 Nov  1  2009 TAG__SC___2006175_0.TAB
-rw-rw-r--  1 cvbntr  xarf  95974 Nov  1  2009 TAG__SC___2006175_0.HDR
-rw-rw-r--  1 cvbntr  xarf   3563 May  8 04:07 TAG__KSM__2012063_0.HDR
-rw-rw-r--  1 cvbntr  xarf   3585 May  8 04:07 TAG__KSO__2012063_0.HDR
-rw-rw-r--  1 cvbntr  xarf  95106 Aug 31 12:56 MAG__KSO__2012171_0.TAB
-rw-rw-r--  1 cvbntr  xarf   3647 Aug 31 12:56 MAG__KSO__2012171_0.HDR
-rw-rw-r--  1 cvbntr  xarf  83424 Oct 22 02:41 TAG__SC___2012230_0.TAB
-rw-rw-r--  1 cvbntr  xarf   3602 Oct 22 02:41 TAG__SC___2012230_0.HDR

What I need :

1 : Find the new files : Files that does not exist on the old ftp log file : print date size & filename
2 : Find the files with a grather size on the new log file ( compare to the old ftp log file ) : : print date size & filename

NOTE : I can't trust dates of files as some old files may be reprocess and get a new date, and some others not. ( I assume you imagine the mess )

Here is output needed as an example :

Code:
RESULT PART 1 : 0
RESULT PART 2 : 
Nov  1  2009 95974 TAG__SC___2006175_0.TAB
Nov  1  2009 95974 TAG__SC___2006175_0.HDR

Thanks a lot for your help.

Last edited by Aswex; 10-22-2012 at 10:49 AM..
# 2  
Old 10-22-2012
Pls use this as a starter to be improved; you may want to sort it according to your rules (for testing I modified your second file for a new name):
Code:
awk 'NR==FNR{Ar[$9]=$5;next}
     !($9 in Ar) {print "Rule 1:", $5,$6,$7,48,$9}
     ($9 in Ar) &&  $5>Ar[$9] {print "Rule 2:", $5,$6,$7,48,$9}
    ' file1 file2
Rule 2: 95974 Nov  1 48 TAG__SC___2006175_0.TAB
Rule 2: 95974 Nov  1 48 TAG__SC___2006175_0.HDR
Rule 1: 83424 Oct 22 48 TAG__SC___2012230_0.TAv

For the size comparison you may need to ensure the two fields to be numerically compared, e.g. by adding a 0 to each field.

Last edited by RudiC; 10-22-2012 at 10:04 AM..
# 3  
Old 10-22-2012
Dear Rudic,

thanks a lot for your help, but what do you mean by :

Code:
For the size comparison you may need to ensure the two fields to be numerically compared, e.g. by adding a 0 to each field.

Do you mind to show me how ? I forgot to say that I am on solaris 9 and I using KSH.

Do you know if it's possible to add a check to see if a file in "ftp log 2" ( the new one ) a file will have a smaller size than the size in "ftp log 1" the older one ? That could be, "rule 3".

example :

the file will have 83924 in ftp log 2, and 95974 in ftp log 1 ..

Thanks again for your help
# 4  
Old 10-22-2012
On my linux/mawk system it will compare sizes OK. If it doesn't on yours, force it to be numerical like$5+0 > Ar[$9]+0. For a third rule, you copy the entire comparing line and invert the comparison. Don't forget to change rule 2 to rule 3 in the print cmd.
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

FTP log only shows FTP LOGIN FROM entry?

OS: Solaris 9 Configuration /etc/syslog.conf daemon.debug /etc/inetd.conf ftp stream tcp6 nowait root /usr/sbin/in.ftpd in.ftpd -A -l -d Found the ftp.log only generate those entries from other servers/hosts. Can we trace on all ftp entries either from/to the server? ... (6 Replies)
Discussion started by: KhawHL
6 Replies

2. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

3. Shell Programming and Scripting

FTP script to login and list files to log file

Hi Guys I did a forum search for "ftp scripts" Looked at 8 pages and didnt see anything that would help. Most seem to be logging into a ftp server and transfering files. What I need to do is login to a FTP server. Goto a folder and list it so it showes newest files first. It would be nice to... (4 Replies)
Discussion started by: voorhees1979
4 Replies

4. Shell Programming and Scripting

FTP check if file exists and log it

Hi, I need to create a script that checks if a file exists on an offsite server which only has ftp enabled. I was originally going to use perls Net::FTP class but the client does not have perl installed nor wants it. So, I have to use a shell script which logs into the server, then ... (1 Reply)
Discussion started by: gseyforth
1 Replies

5. Shell Programming and Scripting

Problem in redirecting ftp msgs to a log file

Hi all.. The following set of statements is used in a shell script to ftp a file to a remote machine I want to redirect the ftp messages thrown by the first ftp statement to a log file. As you can see there is a logic downstream to decide if the ftp was a success or not. But i am not... (5 Replies)
Discussion started by: hareeshkumaru
5 Replies

6. Shell Programming and Scripting

Deleting File from FTP and Transferring File to FTP

Hi, I am getting error when i am deleting file from FTP and also transferring file from local to FTP server. I am getting 221 error. I am getting this error some time only. Some time the existing file from FTP is deleted and file from local directory is transferred to FTP server. ... (2 Replies)
Discussion started by: praka
2 Replies

7. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

8. Shell Programming and Scripting

how to put file from one ftp to another ftp location

hi, I have one file located in ftp.I want to place that file in different ftp location. Up to now i am doing it manually using get command and copying that file in to my local system and then putting that file in different ftp using put command. now i want to automate that using shell... (1 Reply)
Discussion started by: prasee
1 Replies

9. Shell Programming and Scripting

FTP and LOg file creation

Hello, I am new to unix , and I need to create a shell sciprt which helps me FTPing file from LAn to Unix box. These files r then processed using Perl script and put in a database. I also need to log the entire process of all the above methods in a log file in the same shell script. Like ,... (2 Replies)
Discussion started by: agarwalniru
2 Replies

10. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies
Login or Register to Ask a Question