Please Help Guys Important


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Please Help Guys Important
# 1  
Old 03-23-2008
Please Help Guys Important

Dear All

I have an important request:

I have a pattern which look like this:
2 20080219_21:43:22.194 ISC-Libya Belgium1 24 IAM 20115139248 218913265641 b 11672 ACM b 20614 CPG b 20619 CPG b 20626 CPG f 33925 REL b 34215 RLC :COMMA: NCI=00,FCI=6001,CPC=0A,TMR=00,USI: :COMMB: BCI=0201: :RELCAUSE:10:

2 20080219_21:43:40.277 ISC-Libya Belgium1 57 IAM 20111329078 218923547827 b 9365 ACM f 15907 REL b 16184 RLC :COMMA: NCI=10,FCI=6101,CPC=0A,TMR=00,OFI=80,USI: :COMMB: BCI=0434,OBI=01: :RELCAUSE:10:

These patterns have number of fields ($NF) , i want a script that if finds the number of fields inside a certain pattern greater than 30 it delets the whole pattern ?

The Second Requirement :
For $7 and $8 the field begins with a country code say (44) so i want a script which adds additional field according the country code found in $7 and $8.

So the Pattern will be the same but only i will have additional field containing country code of both $7 and $8.
# 2  
Old 03-23-2008
Adding to my last requirement :

For sure the field which will be added to the pattern will be the country name which is according to the country code of $7 and $8 so in the last example as you may see you will find county code (20) so this will be Egypt and 218 which is country code of Libya

Thanks
Zanetti
# 3  
Old 03-24-2008
Dear All

I have a pattern which look like this:
2 20080312_10:55:35.800 Spain-Telefonica ISC 9 IAM 927535957 34670505334 f 275 COT b 700 ACM b 6577 CPG b 10726 ANM b 202195 REL f 202307 RLC :COMMA: NCI=15,FCI=2101,CPC=0A,TMR=00,USI,OFI=00: :COMMB: BCI=0214,OBI=01,ACT: :RELCAUSE:10:

This Pattern has number of fields = NF and at the same time there are large number of patterns like this.

What i want is a script that if it finds NF which is the number of fields greater than 30 it delets the whole pattern till $NF.

Some patterns are placed in a file named CDR.date1
Another files are placed in another file named CDR.date2
and so on.....

Please waiting reply
Zanetti
# 4  
Old 03-24-2008
zanetti321,

Please read the forum rules carefully and stop with bumping your question!

https://www.unix.com/unix-dummies-que...om-forums.html

Regards
# 5  
Old 03-24-2008
I don't fully understand what is your problem/request but it seems to me that all you're after can be done by awk or nawk.

If you can be more specific by actually giving the expected result on the two sample patterns, I might be able to help you with the awk-script.
# 6  
Old 03-24-2008
Do you have a list of country codes, or how are we supposed to know how many of the numbers on the string are supposed to be copied?

(Granted, such a list exists on many systems. Look for ISO3166.xml or something like that. Do you have such a file on your system?)

Are you trying to say, remove lines with more than 30 fields on them? Or kill the fields but keep the newline?

Code:
awk '(NF <= 30) { print }'

# 7  
Old 03-25-2008
Annoying Problem :(

Dear All

Please Ignore the first requirement regarding the country codes my second problem can be explained as follows.Smilie

I have a group of patterns like this :
2 20080324_13:06:31.373 ISC TeleGlobe-Montreal 110 IAM 962795507127 218927119177 f 6 IAM b 3243 REL f 3244 RLC b 3276 REL b 3282 REL f 3284 RLC b 3289 REL f 3294 RLC b 3296 REL b 3302 REL f 3304 RLC b 3309 REL f 3314 RLC b 3316 REL b 3322 REL f 3324 RLC b 3329 REL f 3765 RLC b 3766 REL f 3769 RLC b 3770 REL f 3772 RLC b 3775 REL b 3779 REL b 3783 REL f 3787 RLC b 3787 REL f 3791 RLC b 3792 REL f 3795 RLC b 3796 REL f 3799 RLC b 3800 REL f 3802 RLC b 3805 REL b 3809 REL b 3813 REL b 3817 REL f 3821 RLC b 3822 REL f 3825 RLC b 3826 REL f 3829 RLC :COMMA: NCI=10,FCI=6101,CPC=0A,TMR=00,OFI=80,USI: :COMMB:: :RELCAUSE:22:

As shown the number of fields exceeds 30 (NF>30) , and as an information this pattern is one out of another patterns which are inserted in the same file so i want a a script when if finds pattern from this type (NF>30), it deletes it completely

Thanks and please waiting for feedback because it is really very annoying for me Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help me guys

how to print first line of each repeated 2 fields only if i got files like : USA|Tony|12:25:22:431 USA|John|14:22:42:981 USA|John|08:22:12:349 France|Adam|14:22:42:981 Italy|Tony|18:22:42:212 Italy|Tony|04:22:42:212 Italy|Tony|08:22:42:212 to make output like : ... (9 Replies)
Discussion started by: teefa
9 Replies

2. Cybersecurity

Hey guys

Hey guys, new geek here, sorry I didnt see a intro section. But I do have a question and hope to make my stay here perma. I am interested in IT security, ands I really want to learn, I was hoping for whatever questions I had you guys could lead me through the narrowest path with a broad selection... (1 Reply)
Discussion started by: abeja
1 Replies

3. Shell Programming and Scripting

Please help me guys...

Hi All! I need to write a script which reads a file and tries to insert into the DB using those values... file format: var1 var2 var3 var4 var5 var6 Now I want to read from the above file and trying to insert like... insert into table1 values( var1, var2, var3 ); in a loop to... (2 Replies)
Discussion started by: games_icon
2 Replies

4. UNIX for Advanced & Expert Users

Please Help Me Guys

Dear All I have a pattern which look like this : 2 20080226_18:02:09.749 ISC-Libya Egypt-Cairo2 111 IAM 2913258040 218927157966 b 61 REL f 143 RLC :COMMA:NCI=10,FCI=6101,CPC=0A,TMR=00,OFI=80,USI: :COMMB:: :RELCAUSE:15: 2 20080226_18:02:11.629 ISC-Libya Egypt-Cairo2 170 IAM 93572641... (8 Replies)
Discussion started by: zanetti321
8 Replies

5. UNIX for Advanced & Expert Users

Hi guys...

I want a Bash Shell Script for taking backup of all files created to day and killing all the Process still active of mine at evening every day (1 Reply)
Discussion started by: vinayraj
1 Replies

6. Shell Programming and Scripting

Help guys!

Hello Guys, I have written the following script to do certain job. I have more than 300 files, all are .pdb & .out files. and the files are (1,3,5,7,11,13,15,17,21,.......787,791,793,795).pdb /.out . But the way I created the for loop in my script works only one file at a time. But that is not... (2 Replies)
Discussion started by: chuchu
2 Replies

7. AIX

Thanks guys

Hi guys, I would like to inform you that I have cleared .... IBM Certified Specialist - p5 and pSeries Administration and Support for AIX 5L V5.3 with 89% thanks to you all. Manu (0 Replies)
Discussion started by: b_manu78
0 Replies

8. UNIX for Dummies Questions & Answers

Hi again guys

actually i have important question about unix / linux i'm working on visuall basic and visuall c++ i heared from someone that i can't open them while i useing unix / linux is that right? if yes .......... what's the solution if no ............. thanks :) :D :D thanks my friends (1 Reply)
Discussion started by: M_Hafez
1 Replies

9. BSD

Thank you guys for the advice...

Thank you guys for the advice, and finally i could connect to internet with FREEBSD, this is what i did. I did evrything what the handbook said and still couldn't connect, then i installed a new ethernet card that support freebsd and i did everything what the manual said in how to install the... (0 Replies)
Discussion started by: nobody
0 Replies

10. UNIX for Advanced & Expert Users

i need your guys help

HI. I just accidently wipe out my hard drive when i installed sun solaris, this is the last thing i remember, it ask me if want to delete the partition table, and i said yes" Im a retard" i thought solaris can't see xp partition table. Could anyone help me recover my data back, is it really... (21 Replies)
Discussion started by: souldier
21 Replies
Login or Register to Ask a Question