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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
12-30-2012, 03:14 AM
|
#16
|
|
Member
Registered: Dec 2012
Posts: 40
Original Poster
Rep: 
|
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
|
|
|
|
12-30-2012, 03:23 AM
|
#17
|
|
Senior Member
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,626
|
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.
|
|
|
|
12-30-2012, 03:24 AM
|
#18
|
|
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 8,867
|
Quote:
Originally Posted by eyadgh
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.
|
|
|
|
12-30-2012, 03:31 AM
|
#19
|
|
Member
Registered: Dec 2012
Posts: 40
Original Poster
Rep: 
|
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
|
|
|
|
12-30-2012, 03:35 AM
|
#20
|
|
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,113
|
Quote:
Originally Posted by eyadgh
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?
|
|
|
|
12-30-2012, 03:37 AM
|
#21
|
|
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 8,867
|
Quote:
Originally Posted by eyadgh
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.
|
|
|
|
12-30-2012, 03:38 AM
|
#22
|
|
Member
Registered: Dec 2012
Posts: 40
Original Poster
Rep: 
|
yes i mean the words inside "ctr{ }"
and chek how many words repeated and print number of repeated
|
|
|
|
12-30-2012, 03:39 AM
|
#23
|
|
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,113
|
Quote:
Originally Posted by eyadgh
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?!!!!
|
|
|
|
12-30-2012, 03:39 AM
|
#24
|
|
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 8,867
|
Quote:
Originally Posted by eyadgh
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.
|
|
|
|
12-30-2012, 03:42 AM
|
#25
|
|
Member
Registered: Dec 2012
Posts: 40
Original Poster
Rep: 
|
druna i beleive you are agreat programmar  but your code gove me syntaz error 
|
|
|
|
12-30-2012, 03:48 AM
|
#26
|
|
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,113
|
Quote:
Originally Posted by eyadgh
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.
|
|
|
|
12-30-2012, 04:06 AM
|
#27
|
|
Member
Registered: Dec 2012
Posts: 40
Original Poster
Rep: 
|
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
|
|
|
|
12-30-2012, 04:10 AM
|
#28
|
|
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,113
|
Quote:
Originally Posted by eyadgh
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?
|
|
|
|
12-30-2012, 04:38 AM
|
#29
|
|
Member
Registered: Dec 2012
Posts: 40
Original Poster
Rep: 
|
vitual vmware
|
|
|
|
12-30-2012, 04:41 AM
|
#30
|
|
LQ Veteran
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,113
|
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?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:46 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|