The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copying Text between two unique text patterns spindoctor UNIX for Dummies Questions & Answers 3 01-16-2009 03:42 AM
How can i read a non text file in unix - ELF-64 executable object file - IA64 alexcol UNIX for Advanced & Expert Users 8 11-07-2008 08:56 AM
script to Read Error,jbase,voilation,segmentation words from a file Mujtaba khan Shell Programming and Scripting 3 03-30-2008 01:19 PM
Read words from file and create new file using K-shell. bsrajirs Shell Programming and Scripting 4 06-01-2007 12:15 PM
read specific text from a log file ragha81 Shell Programming and Scripting 4 10-17-2006 01:17 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-30-2007
aditya.ece1985 aditya.ece1985 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 13
how to read all the unique words in a text file

How can i read all the unique words in a file, i used -

cat comment_file.txt | /usr/xpg6/bin/tr -sc 'A-Za-z' '/012'
and
cat comment_file.txt | /usr/xpg6/bin/tr -sdc 'A-Za-z' '/012'
but they didnt worked.....
  #2 (permalink)  
Old 11-30-2007
encrypted's Avatar
encrypted encrypted is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2004
Location: Oslo, Norway
Posts: 219
Does uniq somefile help?
  #3 (permalink)  
Old 11-30-2007
aditya.ece1985 aditya.ece1985 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 13
yes u will be using uniq only but the first part is not working i used -
cat comment_file.txt | /usr/xpg6/bin/tr -sdc 'A-Za-z' '/012' | sort | uniq -c
  #4 (permalink)  
Old 11-30-2007
encrypted's Avatar
encrypted encrypted is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2004
Location: Oslo, Norway
Posts: 219
This one from the archives may help. Although it shows non-unique non-unique words you would need to tweak it.
  #5 (permalink)  
Old 11-30-2007
aditya.ece1985 aditya.ece1985 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 13

thankx anyways
  #6 (permalink)  
Old 11-30-2007
aditya.ece1985 aditya.ece1985 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 13
this is the solution ---

cat comment_file.txt | tr " " "\n" | sort | uniq -c | wc -l
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0