Sponsored Content
Top Forums Shell Programming and Scripting Need help improving my script. Post 302970872 by Scrutinizer on Tuesday 12th of April 2016 10:48:15 PM
Old 04-12-2016
I would suggest to also use some of you vertical real estate, since that will greatly improve readability for future maintenance..

I expect Don's suggestion of using the + instead of \; will significantly increase processing speed.

An untested example of what a single awk might look like:

Code:
find /var/network_logs/gc/archive/asalog*  -mtime -7 -exec zcat {} +  |
awk '
  !/Built inbound|Built outbound/ || /10\.10\.120\.145/ {
    next
  }
  {
    $0=$10 FS $11 FS $15 FS $18                   # recalculate fields
    gsub("[/:]",FS)
    if ($1 == "inbound")
      $0=$1 FS $2 FS $3 FS $4 FS $6 FS $7 FS $8   # recalculate fields
    else if ($1 == "outbound")
      $0=$1 FS $2 FS $6 FS $7 FS $3 FS $4 FS $5   # recalculate fields
  } 
  !seen[$0]++
' >> /home/kenneth.cramer/asa/GC_ports.txt


Last edited by Scrutinizer; 04-12-2016 at 11:57 PM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

improving my script (find & replace)

Hi all, I have a script that scan files, find old templet and replace it with new one. #!/bin/ksh file_name=$1 old_templet=$2 new_templet=$3 # Loop through every file like this for file in file_name do cat $file | sed "s/old_templet/new_templet/g" > $file.new #do a global searce and... (8 Replies)
Discussion started by: amir_yosha
8 Replies

2. Shell Programming and Scripting

improving my script

Hi; I want to access our customer database to retreive all clients that have as language index 2 or 3 and take their client number. My input is a file containing all client numbers. i access the data base using a function call "scpshow". The total number of clients i want to scan is 400 000... (6 Replies)
Discussion started by: bcheaib
6 Replies

3. UNIX for Dummies Questions & Answers

Improving Unix Skills

Kindly any advice to improve my unix skills as electronic books i can download or valuable sites as this one etc... (3 Replies)
Discussion started by: sak900354
3 Replies

4. Shell Programming and Scripting

Improving this validate function

Hi guys, I use this function which was provided to me by someone at this site. It works perfectly for validating a users input option against allowed options.. example: validateInput "1" "1 3 4 5" would return 0 (success) function validateInput { input=$1 allowedInput=$2 for... (4 Replies)
Discussion started by: pyscho
4 Replies

5. Shell Programming and Scripting

Improving code by using associative arrays

I have the following code, and I am changing it to #!/bin/bash hasArgumentCModInfile=0 hasArgumentSrcsInfile=0 hasArgumentRcvsInfile=0 OLDIFS="$IFS" IFS="|=" # IFS controls splitting. Split on "|" and "=", not whitespace. set -- $* # Set the positional... (3 Replies)
Discussion started by: kristinu
3 Replies

6. Shell Programming and Scripting

Basic help improving for in loop

I'm obviously very new to this. I'm trying to write a simple for loop that will read the directory names in /Users and then copy a file into the same subdir in each user directory. I have this, and it works but it isn't great. #!/bin/bash HOMEDIRS=/Users/* for dirs in $HOMEDIRS; do if ];... (5 Replies)
Discussion started by: Heath_T
5 Replies

7. Shell Programming and Scripting

Help with improving korn shell script

I am primarily a SQA/Tester and new to korn shell. How can I improve the following script? #/bin/ksh SourceLocation=~/Scripts/Test/Source TrackerLocation=~/Scripts/Test/Tracker TargetLocation=rdbusse@rdbmbp:/Users/rdbusse/Scripts/Test/Target for file in $(cd $SourceLocation; ls) do ... (7 Replies)
Discussion started by: bayouprophet
7 Replies

8. Shell Programming and Scripting

Improving code

Gents, I did the below code to get an output (report) ,.. the code works fine but I believe it can be more shorted using better method. Please if you can help, to generate same output improving the code , will be great. here my code. # get diff in time awk '{$9=$8-prev8;prev8=$8;print... (8 Replies)
Discussion started by: jiam912
8 Replies
XFERFAXLOG(5)							File Formats Manual						     XFERFAXLOG(5)

NAME
xferfaxlog - HylaFAX activity log DESCRIPTION
The file etc/xferfaxlog contains information about inbound and outbound activities. The file contains one line per inbound or outbound call (except for facsimile documents retrieved by polling in which case multiple entries may be present for a single call). If the modem config setting LogCalls is set to true, then the file also contains one line per received call. Lines are fixed-format, tab-separated ASCII strings. Each record of a facsimile transmission is of the form: date SEND commid modem jobid jobtag sender ``dest-number'' ``CSI'' params #pages jobtime conntime ``reason'' <null> <null> <null> ``owner'' ``dcs'' A facsimile reception record is of the form: date RECV commid modem fax.tif <null> fax ``local-number'' ``TSI'' params #pages jobtime conntime ``reason'' ``CallID1'' ``CallID2'' ``CallID3...CallIDn'' <null> ``dcs'' Each inbound call record is of the form: date CALL commid modem <null> <null> fax ``local-number'' <null> 0 0 jobtime conntime ``reason'' ``CallID1'' ``CallID2'' ``Cal- lID3..CallIDn'' <null> ``dcs'' Each facsimile document retrieved by polling has a record of the form: date POLL commid modem jobid jobtag sender ``dest-number'' ``TSI'' params #pages jobtime conntime ``reason'' <null> <null> <null> An alphanumeric pager request has a record of the form: date PAGE commid modem jobid jobtag sender ``dest-number'' ``<null>'' 0 0 jobtime conntime ``reason'' <null> <null> ``owner'' The following describes the fields in the above records: date The date and time of the transaction in the format MM/DD/YY HH:MM , where MM is the numeric month, DD the numeric day, YY the last two digits of the year, and HH:MM is the time in 24-hour format. commid The communication identifier for the call. modem The device identifier for the modem that was used to do the send or receive. jobid The job number for outbound calls. jobtag The client-specified job tag for outbound calls. fax.tif The associated recvq fax TIFF file for the event. sender The sender/receiver's electronic mailing address (facsimile receptions are always attributed to the ``fax'' user). dest-number The phone number dialed for outgoing calls. TSI The Transmitter Subscriber Identification string (as received) for incoming calls. CSI The Caller Subscriber Identification string of the remote machine (as reported) for outgoing calls. local-number The local phone number on which the data was received. params The negotiated facsimile session parameters used for transferring data encoded as described below. #pages The total number of pages transferred. jobtime The duration of the session; in the format HH:MM:SS. This time includes setup overhead and any time spent cleaning up after a call. conntime The time spent on the phone; in the format HH:MM:SS. This should be the time used by the PTT to calculate usage charges. reason A string that indicates if any problem occurred during the session. CIDName The received CIDName value for the session. CIDNumber The received CIDNumber value for the session. owner The login name of the job owner. dcs The T.30 DCS string that was used in the facsimile communication. Note that fields may have embedded blanks. Session parameters are encoded as a decimal number that contains a packed set of Class 2 ses- sion parameter values. The format is: 2 bits for vertical resolution, 3 bits for signalling rate, 3 bits for page width, 2 bits for page length, 2 bits for data format, 1 bit for ECM use, 1 bit of BF use, and 3 bits for the min scanline time. The page counts are always inte- gral numbers. Partial pages that are to be retransmitted are not included in the page count. The simple ASCII format was designed to be easy to process with programs like awk(1). NOTES
The sender field does not necessarily represent the submitter's actual identity. For example, it reflects the value given by the send- fax(8) ``-f'' option. Be cautious that this field is not utilized for auditing if the fax user base is not trusted. BUGS
The date format will ``break'' in the year 2000. Information should be recorded on a per-page basis for facsimile communications. SEE ALSO
faxq(8) faxsend(8) faxgetty(8) June 5, 1996 XFERFAXLOG(5)
All times are GMT -4. The time now is 01:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy