Sign up to create your own snipts, or login.

Public snipts » filezilla The latest public filezilla snipts.

showing 1-1 of 1 snipts for filezilla
  • sort filezilla server log entries by session id
    #!/bin/bash
    
    #
    # entry example
    #
    # (1579051) 10/16/2009 0:02:13 AM - (not logged in) (192.168.1.11)> USER chris
    #
    # sort -k1n fzs-2009-10-16.log
    # does not work properly because when the session id and timestamp are the same
    # it goes on and tries to sort based on the message
    # if the timestamp granularity was high enough it would work (and so much faster!)
    #
    
    [ $# -ne 1 ] && echo "number of args required is 1" && exit 1
    
    [ ! -e $1 ] && echo "file $1 does not exist" && exit 2
    
    FILEPATH=`dirname $1`
    LOGNAME=`basename $1`
    
    LOGNAME_SORTED=${FILEPATH}/${LOGNAME}".sorted"
    SID_SORTED_FILENAME=${FILEPATH}/"fzlog_sid_sorted.$$"
    
    rm -f $LOGNAME_SORTED
    
    awk '{ split( $1, L, "\\(|\\)" ); print L[ 2 ]; }' $1 | sort | uniq > ${SID_SORTED_FILENAME}
    
    cat ${SID_SORTED_FILENAME} | while read line
    do
            grep "^($line)" $1 >> ${LOGNAME_SORTED}
    done
    
    rm -f ${SID_SORTED_FILENAME}
    
    exit 0
    

    copy | embed

    0 comments - tagged in  posted by cgv on Jan 05, 2010 at 4:52 a.m. EST
Sign up to create your own snipts, or login.