![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Read the directory path | sollins | Shell Programming and Scripting | 1 | 11-05-2008 05:09 AM |
| read files from directory | Satyak | Shell Programming and Scripting | 2 | 10-17-2008 05:20 AM |
| Read Files from a Directory | kiran_418 | UNIX for Dummies Questions & Answers | 2 | 04-18-2008 01:23 PM |
| Read from fileList.txt, copy files from directory tree | fxvisions | Shell Programming and Scripting | 1 | 10-30-2007 05:17 PM |
| FTP to read a directory | jikyj | Shell Programming and Scripting | 11 | 08-27-2003 11:23 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Using Awk within awk to read all files in directory
I am wondering if anyone has any idea how to use an awk within awk to read files and find a match which adds to count.
Say I am searching how many times the word crap appears in each files within a directory. How would i do that from the command prompt ... thanks |
|
||||
|
These solutions count the number of lines containing the character sequence "crap". However, the OP was looking for the number of word occurrences per file. I think what is needed is something like this:
Code:
for i in *; do printf "$i: "; grep -c "\bcrap\b" <(xargs -n1<$i); done Last edited by Scrutinizer; 09-19-2009 at 05:29 PM.. |
![]() |
| Bookmarks |
| Tags |
| awk, awk within awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|