Normal grep
wolf@linux:~$ egrep 4.4.4.4 data.csv
A,4.4.4.4,4.4.4.5,4.4.4.6,3.3.3.3,3.3.3.4
wolf@linux:~$
Since I've a lot of data to grep, I've put it on alias.
wolf@linux:~$ alias z="egrep $1 data.csv"
wolf@linux:~$
But it doesn't work
wolf@linux:~$ z 4.4.4.4
grep: 4.4.4.4: No such file or directory
wolf@linux:~$
It turns out that $1
was missing from the alias.
wolf@linux:~$ alias z
alias z='egrep data.csv'
wolf@linux:~$
What was the reason behind this?