You don't need awk (or similar) to improve the performance of your script. Just by the look on it, it can be seen that you run six commands (= six new processes) in the inner loop, times 50 for the lines in file 2, times millions for the lines in file1 (opening file2 millions times (even though buffered/cached)).
With your input data, and after cleaning out a few quirks in your code snippet, I find
, while
with YY being
An even faster solution might be to use an array to hold file2's contents, and have the outer loop read file1, and an inner loop to iterate through the array doing the comparisons/modifications.
---------- Post updated at 22:00 ---------- Previous update was at 21:36 ----------
Modification using arrays; adapt to taste...:
Timing is similar to the first version; looks like the disk cache is quite powerful:
Hi, everybody.
I just wonder whether there are a couple of free Linux servers running as terminals where people can practice Unix Shell Programming?
I'd like to set up one myself but unfortunatly can't do it. I can't switch to Linux now coz I run a couple of servers on my machine.
Cygwin is... (3 Replies)
About 4 years ago I wrote this tool inspired by Rob Urban's collect tool for DEC's Tru64 Unix. What makes this tool as different as collect was in its day is its ability to run at a low overhead and collect tons of stuff. I've expanded the general concept and even include data not available in... (0 Replies)
I am doing the following script in k shell
sed -i 's/FILENAME/$i/g' TEST/test$j.ctl > TEST/control$j.ctl
In the file it replaces $i for all FILENAME, it doesnot replace with the value of i. I put single quotes like below
sed -i 's/FILENAME/'$i'/g' TEST/test$j.ctl > TEST/control$j.ctl
I... (9 Replies)
We develop software for diagnostic tools for cars. we a use a portable PC(x86) runs Win98 to run our applications.
Hence the working environment in the company is Windows, specifically we use BASIC to develop the GUI, communication functions, DLL, etc. and run them on the Win98 PC.
We suggested... (1 Reply)
Hello All,
Request any one of Unix/Linux masters to clarify on the below.
How far it is feasible to open a new ftp connection for transferring each file when there are multiple files to be sent. I have developed shell script to send all files at single stretch but some how it doesnt suit to... (3 Replies)
One of our database server is suddenly became very slow and i have no clue what to do .Please help. I m sharing the performance inforamtion regarding cpu,harddisk,ram .
########CPU Information########
Machine Uptime Information:
uptime
10:25:06 up 16:50, 1 user, load average: 5.84, 5.65,... (10 Replies)
Hi,
I have been working on Sun Solaris since a long time. Recently I got to work on RH Linux. My Linux version details are:
Linux 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
I have a simple command in my shell script:
export BKPTAG=`date... (3 Replies)
IN solaris, for network high-availability we are using IPMP concept, can u tell me in REDHAT LINUX what we are using... also pls share good step to read & understand the that concept...
Also performance issue in linux what are step & cmd can u tell me??? (2 Replies)
Hi All,
I am facing performance issue while rinning the LINUX shell script.
I have file1 and file 2. File one is the source file and file 2 is lookup file. Need to replace if the pattern is matching in file1 with file2.
The order of lookup file is important as if any match then exit... (8 Replies)
Hi,
I am beginner in shell scripting. I have written a script to parse file(s) having large number of lines each having multiple comma separated strings.
But it seems like script is very slow. It took more than 30mins to parse a file with size 120MB (523564 lines), below is the script code
... (4 Replies)
Discussion started by: imrandec85
4 Replies
LEARN ABOUT DEBIAN
sniffit
SNIFFIT(5) File Formats Manual SNIFFIT(5)NAME
sniffit - configuration file for sniffit (name arbirtary)
DESCRIPTION
This page describes the format for the config file for sniffit (see sniffit(8) ). This file allows you to specify in great detail witch
packets should be processed by sniffit. This file also controls (or will control) some functions for the continuous logging ('-L' option).
A sniffit config file might look like (Be sure to end it with a BLANK line):
# Sniffit Sample Config file -- Brecht Claerhout
logfile /var/log/sniffit.today.log
# First select all packets!
select both mhosts 1
select both mhosts 2
# Now deselect all packets from/to those damn 'surfers'
deselect both port 80
deselect both port 8001
This file will tell sniffit to process all packets on the subnet except those FROM/TO ports 80 and 8001 (thus we don't want logs of those
mass WWW connections witch turn our logs unreadable).
GLOBAL FORMAT
The file consists of lines, lines are formed by fields, fields are separated with SPACES (NO TABS). Unix comment lines (starting with '#'
are allowed). So this gives us:
<field1> <field2> <field3> <field4> <field5>
FIELD FORMAT
<field1>
select - Sniffit will look for packets that match the following description (other fields)
deselect - Sniffit will ignore packets that match the description
logfile - change the logfile name to <field2> instead of the default 'sniffit.log'
<field2>
from - Packets FROM the host matching the following desc. are considered.
to - similar, Packets TO the....
both - similar, Packets FROM or TO the....
a filename - as an argument of 'logfile' in <field1>
<field3>
host - The (de)selection criteria involves a hostname.
port - similar, ... a portnumber
mhosts - The (de)selection criteria involves multiple-hosts, like with the wildcars in 0.3.0, but without the 'x'
<field4>
Either a hostname, a portnumber, a service name or a numbet-dot partial notation indicating multiple hosts depending on <field3>
(service names like 'ftp' are resolved as the services available present on the host that runs Sniffit, and translated into a port
nr)
<field5>
A portnumber, if <field3> was 'host' or 'mhosts' (optional, if not filled in, all ports are going to be (de)selected)
FILE INTERPRETING
The config file is interpreted SEQUENTIAL, so watch it, don't mix lines in a file. Example:
select both mhosts 100.100.12.
deselect both port 80
select both host 100.100.12.2
This file will get you the packets:
a) Send by hosts '100.100.12.*'
b) EXCEPT the WWW packets
c) BUT showing the WWW packets concerning
100.100.12.2
select both mhosts 100.100.12.
select both host 100.100.12.2
deselect both port 80
Will give you the packets (probably unwanted result):
a) Send by hosts '100.100.12.*'
b) Send from/to 100.100.12.2 (useless line)
c) deselecting all WWW packets on the subnet
AUTHOR
Brecht Claerhout <coder@reptile.rug.ac.be>
SEE ALSO sniffit(8)SNIFFIT(5)