Script Optimization required


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Optimization required
# 8  
Old 03-17-2009
not working Smilie

There is an Alphabet after TID:T
so is the sed command is rite one?
# 9  
Old 03-17-2009
Quote:
Originally Posted by saifurshaon
not working Smilie

There is an Alphabet after TID:T
so is the sed command is rite one?
you want that T or not?? i thought you need that T
if not try this
Code:
sed 's/[^ ]* \([^,]*\),.*TID:[A-Z]\([0-9]*.[0-9]*.[0-9]*\).*MNO:\([0-9]*\).*TT:\([0-9]*\).*/\1, \2, \3, \4/g' filename

# 10  
Old 03-17-2009
T will persist.
# 11  
Old 03-22-2009
Dear All,
Still I can't resolve this issue
The file's content is like this (there is 4 spaces after the variable followed by comma)
2009-03-14 22:00:03,420 :: [TID:F090314.20.209][REFID:09031422000200999][MNO:1812513180][NW:AK][STG:TOP][TT:420][INSTRTIME:1237046402999][INENDTIME:1237046403419]
2009-03-14 22:00:03,431 :: [TID:F090314.022.2021][REFID:09031422000300098][MNO:1817220980][NW:AK][STG:TOP][TT:332][INSTRTIME:1237046403098][INENDTIME:1237046403430]


This script is not showing the TID
sed 's/[^ ]* \([^,]*\),.*TID:\(*[0-9]*.[0-9]*.[0-9]*\).*MNO:\([0-9]*\).*TT:\([0-9]*\).*/\1, \2, \3, \4/g' file.txt


Would someone make the correction?
# 12  
Old 03-22-2009
Okay at last i had the solution. I just put and it worked

sed 's/[^ ]* \([^,]*\),.*TID:\([A-Z][0-9]*.[0-9]*.[0-9]*\).*MNO:\([0-9]*\).*TTIN:\([0-9]*\).*/\1, \2, \3, \4/g'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Dummies Questions & Answers

Perl Script:how to find how many parameters are required to run the script

How to find how many parameters are required to run a Perl script? (1 Reply)
Discussion started by: Lakshman_Gupta
1 Replies

3. 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

4. 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

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

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

7. 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

8. 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

9. UNIX for Dummies Questions & Answers

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... (2 Replies)
Discussion started by: aju_kup
2 Replies

10. Shell Programming and Scripting

script required

The line is like this +abc+def+mgh+ddsdsd+sa i.e. words seperated by +. There is a plus in the beginning. i want to conver this line to abc, def, mgh, ddsdsd, sa please provide the logic in the form of a shell script Thanks in advance (13 Replies)
Discussion started by: skyineyes
13 Replies
Login or Register to Ask a Question