Quantcast
Viewing latest article 4
Browse Latest Browse All 4

grep with heredoc in function

I want to make function that parses from text pasted in a terminal.

$ cat <<eof | grep --color sometext
> foo
> sometext
> sometext1
> a sometext
> asdf
> 
> eof
sometext
sometext1
a sometext

While the above works I can make neither an alias nor a function of it.

alias gsi='cat <<eof | grep --color "$1"'
gsi { cat <<eof | grep --color "$1" ; }

I thought redirections weren't executed during function definition.


Viewing latest article 4
Browse Latest Browse All 4

Trending Articles