nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

script to find repeted number/alphabet

This is a discussion on script to find repeted number/alphabet within the Shell scripting forums, part of the Development/Scripting category; Hi I want to know that how can i find a repeated number/alphabet which has been repeated many times? Regards ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2009, 12:13 AM
Senior Member
User
 
Join Date: Jul 2006
Posts: 143
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 4
asim.mcp is on a distinguished road
Default script to find repeted number/alphabet

Hi

I want to know that how can i find a repeated number/alphabet which has been repeated many times?




Regards
Asim
Reply With Quote
  #2 (permalink)  
Old 04-06-2009, 11:08 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Posts: 2,647
Thanks: 11
Thanked 236 Times in 176 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Try grep command:
Code:
grep -w "word" filename
grep "123567" filename
To count word, enter:
Code:
grep -cw "word" filename
grep -c "123567" filename
See Howto use grep command in Linux / UNIX
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 04-09-2009, 02:42 PM
kasimani's Avatar
Senior Member
User
 
Join Date: Jul 2006
Location: India, Delhi
OS: CentOS, RedHat, Fedora, Ubuntu
Posts: 151
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 4
kasimani is on a distinguished road
Send a message via Yahoo to kasimani
Default

may this help U

cat file.txt | sort | uniq -c | sort -nr > sorted.txt
Reply With Quote
Reply

Tags
count numbers , count words , grep , linux , shell scripting , unix


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Shell script to count number of lines in file specified by the second command-line seaman77 Shell scripting 1 03-16-2009 08:46 PM
to find whether update is successfull or not using Ksh Script ali560045 Shell scripting 0 01-06-2009 04:02 PM
Command to find which process is utilizing max number of resources in Red hat Linux Santosh Sharma Linux software 0 01-19-2008 04:12 PM
Script to display number of lines and words from a file newbewie Shell scripting 2 12-07-2007 11:37 PM


All times are GMT +5.5. The time now is 02:13 AM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38