It works for me:
Code:
pwc101@example_win ~ $ cat abc.txt
hjhj.sh
jhdj.txt
skf.pdf
jks.dat
jk.shd
vsh.txt
sh.ro
pwc101@example_win ~ $ egrep -v "*\.sh$" abc.txt
jhdj.txt
skf.pdf
jks.dat
jk.shd
vsh.txt
sh.ro
pwc101@example_win ~ $
Try
Code:
grep -v -E "*\.sh$" abc.txt > def.txt
instead.
grep -E and egrep are synonymous.
I tested this on RedHat:
Code:
pwc101@example ~$ grep --version; echo; cat /etc/redhat-release; echo; bash --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Red Hat Enterprise Linux WS release 4 (Nahant Update 5)
GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.
pwc101@example ~$
and Cygwin:
Code:
pwc101@example_win ~ $ grep --version; echo; bash --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU bash, version 3.2.39(19)-release (i686-pc-cygwin)
Copyright (C) 2007 Free Software Foundation, Inc.
pwc101@example_win ~ $