To find the repeated name in subject


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To find the repeated name in subject
# 1  
Old 06-10-2009
To find the repeated name in subject

Hi,

I am using a mail application, When I use to check with the command, I will get the outputs as

q -s
6128175 (9, 9/6128175)
Return-path: minka.bell@abcd.org
From: "Minka Bell" <minka.bell@abcd.org>
To: <dcrouch@xyz.org>,
Subject: Open items with new PICT system
Date: Wed, 10 Jun 2009 13:31:27 -0400
Size: 1752 bytes


Using the shell script, how can i track out the more connections established of "From address" of the domain.
# 2  
Old 06-10-2009
What output should you get from the example above?
# 3  
Old 06-10-2009
For Eg:

100 <domainname>

Where 100 is the count of the From address of the domain.
# 4  
Old 06-10-2009
I'm guessing you want someting like this:
Code:
grep '^From:' somebigfile | sed -e 's/<//' -e 's'>//'   |
awk -F'@'  '{arr[$2]++} END { for( i in arr) {print i, arr[i]} } '

# 5  
Old 06-10-2009
Code:
nawk -F'[@>]' '/^From:/ {a[$(NF-1)]} END{for(i in a) print a[i], i}' myFile

# 6  
Old 06-10-2009
Thank you for your update. Sorry to say, both did not work well.
I need the command q -s should be call from the script, i hope then only it will come out with the result.
# 7  
Old 06-10-2009
Quote:
Originally Posted by gsiva
Thank you for your update. Sorry to say, both did not work well.
I need the command q -s should be call from the script, i hope then only it will come out with the result.
I don't quite understand what's being said here, but...
Code:
q -s | nawk -F'[@>]' '/^From:/ {a[$(NF-1)]} END{for(i in a) print a[i], i}'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk script to find repeated IP adress from trace file (.tr)

+ 8.00747 /NodeList/0/DeviceList/0/$ns3::PointToPointNetDevice/TxQueue/Enqueue ns3::PppHeader (Point-to-Point Protocol: IP (0x0021)) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 63 id 0 protocol 17 offset (bytes) 0 flags length: 540 10.1.3.3 > 10.1.2.4) ns3::UdpHeader (length: 520 49153 >... (11 Replies)
Discussion started by: Nipa
11 Replies

2. UNIX for Dummies Questions & Answers

Reading between a repeated string

I have a requirement where I have to read the lines between a repeated string FileName: abc.txt ls /data/abc.txt 1 2 #ZENCO 3 4 5 6 #ZENCO 11 213 454 7 #ZENCO (8 Replies)
Discussion started by: eskay
8 Replies

3. Shell Programming and Scripting

Getting the most repeated column

Hi all , i want to get the most repeated column in my file File: name,ID adam,12345 ----1 adam,12345 ----2 adam,934 adam,12345 ----3 john,14 john,13 john,25 ----1 john,25 ----2 tom,1 -----1 tom,2 -----1 so my output to be (5 Replies)
Discussion started by: teefa
5 Replies

4. Shell Programming and Scripting

Getting most repeated 3 lines

Hi all if i want to get the 3 lines of the most repeated lines here tony,1,x tony,1,x tony,2,x tony,2,x tony,3,x tony,4,x tony,5,x adam,1,y to get output tony,1,x tony,2,x tony3,x adam,1,y (3 Replies)
Discussion started by: teefa
3 Replies

5. Shell Programming and Scripting

Find repeated word and take sum of the second field to it ,for all the repeated words in awk

Hi below is the input file, i need to find repeated words and sum up the values of it which is second field from the repeated work.Im trying but getting no where close to it.Kindly give me a hint on how to go about it Input fruits,apple,20,fruits,mango,20,veg,carrot,12,veg,raddish,30... (11 Replies)
Discussion started by: 100bees
11 Replies

6. Shell Programming and Scripting

How to find repeated string in a text file

I have a text file where I need to find the string = ST*850* This string is repetaed several times in the file, so I need to know how many times it appears in the file, this is the text files: ISA*00* *00* *08*925485USNR *ZZ*IMSALADDERSP... (13 Replies)
Discussion started by: cucosss
13 Replies

7. Shell Programming and Scripting

Repeated Pattern

I have a list like this: todu todo tofe tafo I want to grep only the lines where the 2nd and the 4th character are the same. In this case I would get only "todo". Thanks. (3 Replies)
Discussion started by: rlopes
3 Replies

8. UNIX for Dummies Questions & Answers

how to find a word repeated in a file

Hi everyone, I have a file in which a word is repeated more than one time and I want to know how many times it is repeated. ex: if i repeated word 'guru' in 10 lines I can get the o/p as: cat filename | grep -c 'guru'. How ever if the word is repeated more than one time, then how can I... (4 Replies)
Discussion started by: gurukottur
4 Replies

9. Shell Programming and Scripting

Get rid of repeated entries.

I have the following problem. The file contains many lines already sorted according to their first arguments. Some of these first arguments are repetitive. For each first argument value, I need to keep the first and the last line that contain it. For example, ... 1 234 1 348 ... ... 5 483... (2 Replies)
Discussion started by: jijibabawu
2 Replies

10. Programming

Repeated printF causes annoyance with do

This gives : after calling it twice: how can i solve this so that on output i get : (8 Replies)
Discussion started by: C|[anti-trust]
8 Replies
Login or Register to Ask a Question