LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-30-2012, 04:14 AM   #16
eyadgh
Member
 
Registered: Dec 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled

druna my friend understand me i want to count the repeated words and print the number of repeated words and print other words which not repeated
 
Old 12-30-2012, 04:23 AM   #17
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Can you give us an example of the output which you want to get (i.e. you write it yourself like you want the program to print it) and then show us the output you're getting from druuna's code? That way we can have a better idea of what the "problem" with druuna's code is.
 
Old 12-30-2012, 04:24 AM   #18
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by eyadgh View Post
druna my friend understand me i want to count the repeated words and print the number of repeated words and print other words which not repeated
I do believe the below prints what you want.
Code:
ZainUnlimited : 1
AlBarakehNew : 1
ZainElKulSN : 1
Mo7afazat : 1
ZainElKul : 2
JaishanaIN : 1
If not: Give us a relevant/expected output example.
 
Old 12-30-2012, 04:31 AM   #19
eyadgh
Member
 
Registered: Dec 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
i want code print how many word repeated in this file and for the words which not repeated print each word.

for example the output must be like this :

ZainUnlimited : 1
AlBarakehNew : 2
ZainElKulSN : 1
Mo7afazat : 15
ZainElKul : 100
JaishanaIN : 10
 
Old 12-30-2012, 04:35 AM   #20
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,595
Blog Entries: 1

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
Quote:
Originally Posted by eyadgh View Post
i want code print how many word repeated in this file and for the words which not repeated print each word.

for example the output must be like this :

ZainUnlimited : 1
AlBarakehNew : 2
ZainElKulSN : 1
Mo7afazat : 15
ZainElKul : 100
JaishanaIN : 10
That's exactly what druuna's code does. You need to explain it in more details:

1. You said we only need to take into consideration words inside the ctr{...} tags. (OK)
2. It lists those words and prints the number of occurrences. (OK)

Is the data file the WHOLE file?
 
Old 12-30-2012, 04:37 AM   #21
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by eyadgh View Post
i want code print how many word repeated in this file and for the words which not repeated print each word.

for example the output must be like this :

ZainUnlimited : 1
AlBarakehNew : 2
ZainElKulSN : 1
Mo7afazat : 15
ZainElKul : 100
JaishanaIN : 10
How does this differ from the output I gave???

Run my code on the example data you gave in post number 7. I do believe that the data posted is either not relevant or incomplete.
 
Old 12-30-2012, 04:38 AM   #22
eyadgh
Member
 
Registered: Dec 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
yes i mean the words inside "ctr{ }"
and chek how many words repeated and print number of repeated
 
Old 12-30-2012, 04:39 AM   #23
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,595
Blog Entries: 1

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
Quote:
Originally Posted by eyadgh View Post
yes i mean the words inside "ctr{ }"
and chek how many words repeated and print number of repeated
So can you tell us exactly what is wrong with druuna's output?!!!!
 
Old 12-30-2012, 04:39 AM   #24
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by eyadgh View Post
yes i mean the words inside "ctr{ }"
and chek how many words repeated and print number of repeated
I gave a working solution to what you posted in this thread.

You keep repeating the same stuff, which will get you nowhere.

I'm done here.
 
Old 12-30-2012, 04:42 AM   #25
eyadgh
Member
 
Registered: Dec 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
druna i beleive you are agreat programmar but your code gove me syntaz error
 
Old 12-30-2012, 04:48 AM   #26
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,595
Blog Entries: 1

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
Quote:
Originally Posted by eyadgh View Post
druna i beleive you are agreat programmar but your code gove me syntaz error
1. Copy druuna's code and paste it into your terminal. Don't retype it as you might have made some typos.
2. If it gives you errors. Please copy/paste the command/errors here.

You saying that it gives you errors doesn't tell us much. We are not mind readers.
 
Old 12-30-2012, 05:06 AM   #27
eyadgh
Member
 
Registered: Dec 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
awk:syntax error near line 1
awk:illegal statment near line 1
awk:syntax error near line 1
awk:illegal statment near line 1
awk:bailling out near line 1
 
Old 12-30-2012, 05:10 AM   #28
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,595
Blog Entries: 1

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
Quote:
Originally Posted by eyadgh View Post
awk:syntax error near line 1
awk:illegal statment near line 1
awk:syntax error near line 1
awk:illegal statment near line 1
awk:bailling out near line 1
How exactly are you running the code? Are you running it on windows?
 
Old 12-30-2012, 05:38 AM   #29
eyadgh
Member
 
Registered: Dec 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
vitual vmware
 
Old 12-30-2012, 05:41 AM   #30
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,595
Blog Entries: 1

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
1. What Linux distribution?
2. Can you post what exactly you type in the command line (copy/paste)?
3. Can you provide the WHOLE input file?

Can you answer/address ALL 3 points above?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify the only one pattern among two patterns in a text file linuxromeo Linux - Newbie 3 11-22-2010 04:43 AM
Prompt the user for a file to open, extract the XML and write to another text file. richiep Linux - Newbie 7 10-22-2010 04:34 PM
Extract certain text info from text file xmrkite Linux - Software 30 02-26-2008 12:06 PM
search / count unique patterns in text file logicalfuzz Linux - Newbie 2 10-14-2006 08:58 AM


All times are GMT -5. The time now is 12:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration