[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grep pattern from files
From: |
michael-franzese |
Subject: |
Re: Grep pattern from files |
Date: |
Thu, 22 Apr 2021 21:56:22 +0200 |
Have had a go at writing
grepot ()
{
grep --include="*.org" --include="*.texi" -hir "${1}" "$@:2"
}
But testing it with
grepot --include="*.el" "-C 8 ddd ./"
resulted in the message
grep: 8 ddd ./:2: invalid context length argument
> Sent: Friday, April 23, 2021 at 7:28 AM
> From: michael-franzese@gmx.com
> To: "help bash" <help-bash@gnu.org>
> Subject: Grep pattern from files
>
> Have written the following function to search for strings in
> org and texi files
>
> I call it this way
>
> grepot num pattern dir
>
> grepot ()
> { grep --include="*.org" --include="*.texi" -hir -C "$1" "$2" "$3"; }
>
> But now I would like to extend it so I can include other file types
> such as emacs-lisp files.
>
> But I need some ideas on implementation as I think that my function
> does have some serious limitiations.
>
>