Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help on optimization of the script Post 302146293 by aju_kup on Tuesday 20th of November 2007 12:23:59 AM
Old 11-20-2007
Help on optimization of the script

Hi,

I have prepared script which is taking more time to process. find below script and help me with fast optimized script:-



cat name.txt | while read line
do

name=$(echo $line| awk '{print $8}')

MatchRecord=$(grep $name abc.txt | grep -v grep )

echo "$line | $MatchRecord" | awk -F"|" '
BEGIN { format = "%-6s %-10s %-10s %-4s %-19s %-6s %-2s %-6s %-4s\n" }
{
split($1, rsp," ")
split($2, req," ")
printf format, req[1], rsp[2], rsp[3], rsp[4], req[5], rsp[6], rsp[7],
rsp[8], rsp[9]
}'
done >> /tmp/new.txt
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script optimization

:o Hi, I am writing a script in which at some time, I need to get the process id of a special process and kill it... I am getting the PID as follows... ps -ef | grep $PKMS/scripts | grep -v grep | awk '{print $2 }'can we optimize it more further since my script already doing lot of other... (3 Replies)
Discussion started by: vivek.gkp
3 Replies

2. Shell Programming and Scripting

Script Optimization required

Dear All, Sorry to bother you. But I tried the below problem but didn't come up a good solution. A have a file containing such info 2009-03-14 22:01:01,430 :: 2009-03-14 22:05:01,430 :: I need to show simply 22:01:01, 568, 181, 472 22:05:01, 903, 458, 572 that is time, TID,... (11 Replies)
Discussion started by: saifurshaon
11 Replies

3. UNIX for Dummies Questions & Answers

unix script optimization

I have a file which contains 9,200,000. It contains 125 clolumns. I have to rearrange some columns and exclude some of them. I scripted the following script to do the same. It is working fine but it is taking more than 4hrs to do it. can it be optmized. Here is the script LOC="/sourcefile/"... (3 Replies)
Discussion started by: max_payne1234
3 Replies

4. Shell Programming and Scripting

AWK optimization

Hello, Do you have any tips on how to optimize the AWK that gets the lines in the log between these XML tags? se2|6|<ns1:accountInfoRequest xmlns:ns1="http://www.123.com/123/ se2|6|etc2"> .... <some other tags> se2|6|</ns1:acc se2|6|ountInfoRequest> The AWK I'm using to get this... (2 Replies)
Discussion started by: majormark
2 Replies

5. Shell Programming and Scripting

Looking for optimization advice on a short script

I already have a solution to my problem, but I'm looking to see if it can be made more succinct and faster. The problem: given a list, as shown below, extract the pathname for any file in a directory named 'ample' and return it's index into the list. The index is also in the data itself. Note that... (1 Reply)
Discussion started by: prigo
1 Replies

6. Shell Programming and Scripting

Awk script gsub optimization

I have created Shell script with below awk code for replacing special characters from input file. Source file has 6 mn records. This script was able to handle 2 mn records in 1 hr. This is very slow speed and we need to optimise our processing. Can any Guru help me for optimization... (6 Replies)
Discussion started by: Akshay
6 Replies

7. Shell Programming and Scripting

Script Optimization - large delimited file, for loop with many greps

Since there are approximately 75K gsfiles and hundreds of stfiles per gsfile, this script can take hours. How can I rewrite this script, so that it's much faster? I'm not as familiar with perl but I'm open to all suggestions. ls file.list>$split for gsfile in `cat $split`; do csplit... (17 Replies)
Discussion started by: verge
17 Replies

8. Shell Programming and Scripting

CPU optimization

hi guys , I have 10 scripts suppose 1.sh , 2.sh ,3.sh ,4.sh ......10.sh each takes some time ( for instance 2 minutes to 40 minutes ) my server can run around 3-4 files at a time suppose, 1.sh , 2.sh , 3.sh are running currently now as soon as ANY ONE of the gets finished i... (4 Replies)
Discussion started by: Gl@)!aTor
4 Replies

9. Shell Programming and Scripting

Code optimization

Hi all I wrote below code: #!/bin/sh R='\033 do you have any idea how to optimize my code ? (to make it shorter eg.) (11 Replies)
Discussion started by: primo102
11 Replies

10. UNIX for Advanced & Expert Users

Need Optimization shell/awk script to aggreagte (sum) for all the columns of Huge data file

Optimization shell/awk script to aggregate (sum) for all the columns of Huge data file File delimiter "|" Need to have Sum of all columns, with column number : aggregation (summation) for each column File not having the header Like below - Column 1 "Total Column 2 : "Total ... ...... (2 Replies)
Discussion started by: kartikirans
2 Replies
IRDADUMP(8)															       IRDADUMP(8)

NAME
irdadump - monitors the IrDA traffic on one or more links. SYNOPSIS
irdadump [ -b ] [ -c n ] [ -d ] [ -x ] [ -s n ] [ -t ] [ -l ] [ -v ] [ -i device ] OPTIONS
-b dump bytes in columns -c n set snapcols for byte printing with -b option -d prints the time difference between the current and the previous frame -x dump frame (bytes and ascii) -s n set snaplen for -b and -x option -t force TTP decoding of unknown connections -l set line buffering on output file -v verbose -i device interface DESCRIPTION
irdadump is a tool for monitoring the IrDA traffic on one or more links. Just write "make" to compile the program. When you run the pro- gram, you should be able to see the IrDA traffic (if any). One advantage of implementing IrDA device drivers as network device drivers is that you should be able to attach sniffers to the device (or actually the packet type). That way, it is possible to use a really handy utility called irdadump (instead of tcpdump). This will make debugging MUCH easier. Linux-2.2 implements the BPF (Berkeley Packet Filter), so its possible to filter out exactly the frames you want to see. You may use hostname to separate different machines names. Or grep to filter the output, too. irdadump must be run as root or installed setuid root, as it requires root privileges. EXAMPLES
The output should look something like this: / # ./irdadump 20:11:45.412199 xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:45.492137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:45.572137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:45.652208 xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:45.732137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 20:11:45.812137 xid:cmd 0x0015c23b > 0xffffffff S=6 s=5 20:11:45.892175 xid:cmd 0x0015c23b > 0xffffffff S=6 s=255 Linux 20:11:45.902362 xid:rsp 0xf7be8388 < 0x0015c23b S=6 s=5 ACTiSYS IR100M 20:11:48.412197 xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:48.492656 xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:48.572177 xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:48.652169 xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:48.732177 xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 20:11:48.812153 xid:cmd 0x0015c23b > 0xffffffff S=6 s=5 20:11:48.822371 xid:rsp 0xf7be8388 < 0x0015c23b S=6 s=4 ACTiSYS IR100M 15 packets received by filter Turning on the "-d" option will make irdadump print the time difference between the current and the previous frame: / # ./irdadump -d 20:11:18.412475 (0982.06 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:18.492345 (0079.87 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:18.572376 (0080.03 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:18.652979 (0080.60 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:18.732354 (0079.38 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 20:11:18.755093 (0022.74 ms) xid:rsp 0xf7be8388 < 0x0015c23b S=6 s=3 ACTiSYS IR100M 20:11:18.812350 (0057.26 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=5 20:11:18.892518 (0080.17 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=255 Linux 20:11:21.412486 (2519.97 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=0 20:11:21.492395 (0079.91 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=1 20:11:21.572368 (0079.97 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=2 20:11:21.652405 (0080.04 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=3 20:11:21.732458 (0080.05 ms) xid:cmd 0x0015c23b > 0xffffffff S=6 s=4 irdadump must be run as root or installed setuid root, as it requires root privileges. irdadump -d -x -s 256 will check the contents of the frames. This should tell us if the frames have malformed content, or if the irda stack is doing something wrong. DIAGNOSTICS
N.N. BUGS
N.N. SEE ALSO
irattach(8), irdaping(8), irdadump(8), findchip(8), irpsion5(8), modprobe(8) Linux/IrDA Project http://irda.sourceforge.net -*- Linux/IrDA-Tutorial http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/index.html -*- Infrared-HOWTO http://tuxmobil.org/howtos.html AUTHOR
This manual page is written by Werner Heuser <wehe@tuxmobil.org>. It is based on the READMEs from irda-utils by the Linux/IrDA Project and the Linux/IrDA-Tutorial. COPYRIGHT
Copyright (c) 2001 Werner Heuser Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License (GFDL), Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. 03 July 2006 IRDADUMP(8)
All times are GMT -4. The time now is 12:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy