In bash, turn on the globstar option so that ** matches any level of subdirectories. You can do this from your ~/.bashrc. Also turn on the extglob options to activate ksh extended patterns.

shopt -s globstar extglob


Then:

grep PATTERN **/trunk/src/**/*.@(h|cpp)


Beware that bash versions up to 4.2 follow symlinks to directories when you use **.

Zsh makes this easier, you don't need to set any options and can just type

grep PATTERN **/trunk/src/**/*.(h|cpp)


If the command line is too long, and you're on Linux or other platform with GNU grep, you can make grep recurse instead of the shell to save on the command line length.

grep -R --include='*.cpp' --include='*.h' PATTERN **/trunk/src


Get list of all files by mask in terminal
I load content in a UITableView from a WS and I tried to load the images asynchronous.
   Every time when I "move" the table the images are loading again.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"NewsCell";
    NewsCell *cell = ......

    NewsObject *obj = [self.dataSourceArray objectAtIndex:indexPath.row];

    cell.labelTitle.text   = obj.title;
    cell.textViewNews.text = obj.summary;

    cell.imgListIcon.image = nil;
    dispatch_queue_t imageQ = dispatch_queue_create("imageQ", NULL);
    dispatch_async(imageQ, ^{

        NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:obj.img]];
        dispatch_async(dispatch_get_main_queue(), ^{
            cell.imgListIcon.image = [UIImage imageWithData:imageData];

            [cell setNeedsLayout];
            [cell.spinner stopAnimating];
        });
    });
    dispatch_release(imageQ);

    return cell;
}


Can someone help me with some advice about this problem? Thank you!
