Re: [CentOS] Text file manipulation in CentOS?

2010-05-13 Thread Dominik Zyla
On Thu, May 13, 2010 at 04:59:06AM +0100, hadi motamedi wrote: For mangling text??!! I think your example is way off topic for this Thank you for your reply. I thought to write C code to accomplish this but next I found very powerful centos tools for this application from the help

Re: [CentOS] Text file manipulation in CentOS?

2010-05-13 Thread hadi motamedi
Those tools are not centos only. Thank you for your reply. Yes, you are right. But my server is running centos and so I wanted to find its power in text file manipulations (rather than trying to write C code). ___ CentOS mailing list CentOS@centos.org

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread Dominik Zyla
On Wed, May 12, 2010 at 05:20:58AM +0100, hadi motamedi wrote: If I understand correctly, you can pipe your output to: `awk '{a=$1} {if (a 3) print a}''. `a' is awk variable. `$1' is first column of awk input so you probably need to change it. Thank you for your message .

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread hadi motamedi
So, read `man awk', `man sed' etc, I found the answer. It was very easy , as you told me in your first post . It is as : #uniq -c file name Sorry that I did not noticed it. ___ CentOS mailing list CentOS@centos.org

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread Les Mikesell
On 5/11/2010 11:48 PM, John R. Dennison wrote: To any on the list *other* than Hadi that I've offended by this post you have my most sincere apologies. Sorry for wasting your time but this has been building up for a long time. You sound like someone who learned the unix

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread Kenneth Wolcott
On Wed, May 12, 2010 at 13:14, Les Mikesell lesmikes...@gmail.com wrote: On 5/11/2010 11:48 PM, John R. Dennison wrote:       To any on the list *other* than Hadi that I've offended by this       post you have my most sincere apologies.  Sorry for wasting your       time but this has been

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread Les Mikesell
On 5/12/2010 3:53 PM, Kenneth Wolcott wrote: Almost any introductory book on Linux/UNIX that covers the standard command line utilities (sed, awk, greg, egrep, tr, cut, etc) could have answered the questions he had. I don't think you've actually looked at current introductory books.

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread Kenneth Wolcott
On Wed, May 12, 2010 at 14:17, Les Mikesell lesmikes...@gmail.com wrote: On 5/12/2010 3:53 PM, Kenneth Wolcott wrote:    Almost any introductory book on Linux/UNIX that covers the standard command line utilities (sed, awk, greg, egrep, tr, cut, etc) could have answered the questions he had.

Re: [CentOS] Text file manipulation in CentOS?

2010-05-12 Thread hadi motamedi
For mangling text??!! I think your example is way off topic for this Thank you for your reply. I thought to write C code to accomplish this but next I found very powerful centos tools for this application from the help of you Gentlemen. ___ CentOS

[CentOS] Text file manipulation in CentOS?

2010-05-11 Thread hadi motamedi
Dear All From my previous posts , I learned from you to make use of 'sort' , 'grep' , and 'grep -v' to manipulate text files . At now, I have generated a large text file from my autoexpect script. To be more specific, I need to find how many distinct records are there in say column#1? How can I

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread sheraznaz
Can you sample input and expected result. Sent from my Verizon Wireless BlackBerry -Original Message- From: hadi motamedi motamed...@gmail.com Date: Tue, 11 May 2010 09:09:23 To: CentOS mailing listcentos@centos.org Subject: [CentOS] Text file manipulation in CentOS

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread sheraznaz
that through a loop and only show those that are less than threshold? Thanks Sheraz --Original Message-- From: sheraz...@yahoo.com Sender: centos-boun...@centos.org To: CentOS mailing list ReplyTo: CentOS mailing list Subject: Re: [CentOS] Text file manipulation in CentOS? Sent: May 11

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread hadi motamedi
I don't quite understand this part. Thank you very much for your reply.Please find below a segment of the file: CallId 9 State TK Bts 7 Bt 2 Tr (13 0x09) E1 (4 1 5) Tru (0 3 0) CallId 9 State TK Bts 7 Bt 2 Tr (13 0x09) E1 (4 1 5) Tru (0 3 0) CallId 9 State TK

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread Eduardo Grosclaude
On Tue, May 11, 2010 at 5:51 AM, hadi motamedi motamed...@gmail.com wrote: I don't quite understand this part. Thank you very much for your reply.Please find below a segment  of the file: If you give the following command: sort YOUR_FILE | uniq -c | sort -n | perl -ne 'print unless /(\d+)/

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread hadi motamedi
Does this help? The first number is the number of occurrences of each CallId Thank you for your help. It is very important for me to how the number of occurances of each CallId# . But can you please let me know why the number obtained from your code does not match with manual counting on say one

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread Eduardo Grosclaude
On Tue, May 11, 2010 at 8:12 AM, hadi motamedi motamed...@gmail.com wrote: Does this help? The first number is the number of occurrences of each CallId Thank you for your help. It is very important for me to how the number of occurances of each CallId# . But can you please let me know why

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread Dominik Zyla
On Tue, May 11, 2010 at 08:25:43AM +, sheraz...@yahoo.com wrote: To be more specific, I need to find how many distinct records are there in say column#1? awk '{print $1}' filename | sort -u | wc -l This will show how many unique entries are present in column one (use awk -F to

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread hadi motamedi
$ cat hadi | sort | uniq -c -w 9 | sort -n | perl -ne 'print unless /(\d+)/ and $1 3' 4 CallId 91 State TK Bts 5 Bt 1 Tr (4 0x0f) E1 (4 0 18) Tru (0 1 1) 7 CallId 92 State CL Bts 7 Bt 1 Tr (6 0x0a) E1 (3 1 Thank you for your reply. To just have one

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread hadi motamedi
If I understand correctly, you can pipe your output to: `awk '{a=$1} {if (a 3) print a}''. `a' is awk variable. `$1' is first column of awk input so you probably need to change it. Thank you for your message . Yes , you are right . I really need to filter out that CallId with number of

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread Eduardo Grosclaude
On Wed, May 12, 2010 at 1:12 AM, hadi motamedi motamed...@gmail.com wrote: $ cat hadi | sort | uniq -c -w 9 | sort -n | perl -ne 'print unless /(\d+)/ and $1 3'      4 CallId 91  State TK         Bts 5  Bt 1  Tr (4 0x0f)  E1 (4 0 18)  Tru (0 1 1)      7 CallId 92  State CL         Bts 7  

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread John R. Dennison
On Wed, May 12, 2010 at 05:12:48AM +0100, hadi motamedi wrote: $ cat hadi | sort | uniq -c -w 9 | sort -n | perl -ne 'print unless /(\d+)/ and $1 3' 4 CallId 91 State TK Bts 5 Bt 1 Tr (4 0x0f) E1 (4 0 18) Tru (0 1 1) 7 CallId 92 State CL Bts 7 Bt 1 Tr

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread hadi motamedi
I'm likely to get in trouble for this, but frankly I don't really care. Sorry. I just provided the data that the Gentlemen were asking me . I thought that they are interested in my case and want to check out my mistakes. Sorry bothering you

Re: [CentOS] Text file manipulation in CentOS?

2010-05-11 Thread Chris Geldenhuis
John R. Dennison wrote: On Wed, May 12, 2010 at 05:12:48AM +0100, hadi motamedi wrote: $ cat hadi | sort | uniq -c -w 9 | sort -n | perl -ne 'print unless /(\d+)/ and $1 3' 4 CallId 91 State TK Bts 5 Bt 1 Tr (4 0x0f) E1 (4 0 18) Tru (0 1 1) 7 CallId 92