Quantcast
Viewing all articles
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 all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>