In Linux, would it be possible to create a multi-pipe command, serving the same type of command ie: grep however different output alteration done to it?
Strict example:
grep 10-Feb file.txt | awk '{print $2}' | cut -d . -f 1,2 | sort | uniq -c | sort -rn | head -20 ;
grep 10-Feb file.txt | awk '{print $2}' | sort | uniq -c | sort -rn | head ;
grep 10-Feb file-txt [..]
Would it be possible to make the first grep and path an argument, and make it automatically apply to the following commands?
$=[grep 10-Feb file.txt] | awk '{print $2}' | cut -d . -f 1,2 | sort | uniq -c | sort -rn | head -20 ;
$ | awk '{print $2}' | sort | uniq -c | sort -rn | head ;
$ [..]
As an edit:
I cannot set-up the above command in a bash script since I have limited access to root from which I can call the scripts from.
I am interested in assigning a command as a variable from the command line solely.