![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search for a word | on9west | Shell Programming and Scripting | 2 | 04-23-2008 04:15 AM |
| to get a line above the search word | sachin.gangadha | UNIX for Dummies Questions & Answers | 16 | 01-07-2008 07:19 AM |
| String search - Command to find second occurance | saurabhsinha23 | UNIX for Dummies Questions & Answers | 5 | 12-06-2007 08:03 PM |
| Word search in awk | videsh77 | Shell Programming and Scripting | 8 | 03-08-2007 11:40 PM |
| Search about word | abu_hassan | SUN Solaris | 3 | 02-19-2007 01:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
search for a word and learn number of occurance of that word
hey to everybody
this is my first post at this forum I need a very immediate answer for this question. If you can, I will be delightfull I have a file called example.txt and I want to seek for the for hello and learn the number of the occurance of hello Last edited by legendofanatoli; 05-05-2008 at 05:04 PM.. |
|
||||
|
if hello can occur only one time in a line of text: Code:
grep -c 'hello' example.txt otherwise Code:
#!/bin/ksh wc -l example.txt | read start dummy sed 's/hello//g' example.txt | wc -c read end count=$( (start - end ) /5 ) echo $count |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|