Hi!
Trying my new knowledge on using pipes and grep on some ls filelisting output and notice grep really works strange.
If I try ls -l | egrep -i '*te*' it doesn't just find files containing the 'te'-string, it lists almost every file in my home-folder. Just check a little sample of the large output. Doesn't make much sence.
-rw-rw-r-- 1 seb seb 138454 maj 6 16:21 alien-night.1024.jpg
-rw-rw-r-- 1 seb seb 939871 maj 8 13:49 autoconf2.5-2.59-6mdk.src.rpm
-rw-r--r-- 1 seb seb 16 maj 25 14:03 bort
drwx------ 3 seb seb 4096 maj 24 16:39 Desktop/
-rw-rw-r-- 1 seb seb 2306461 maj 8 13:45 gtk+-1.2.10-41mdk.src.rpm
drwxrwxr-x 6 seb seb 4096 maj 25 20:40 JavaApplication1/
drwxrwxr-x 6 root root 4096 maj 25 12:37 rss-kde-0.3/
-rw-rw-r-- 1 seb seb 4858642 maj 25 12:28 rss-kde-0.3.tar.bz2
-rw-r--r-- 1 seb seb 200424 maj 3 23:22 stargate.jpg
While trying ls -l | egrep -i '*test*' it just finds the files containing the 'test'-string as follows.
$ ls -l | egrep -i '*test*'
-rw-r--r-- 1 seb seb 1039 maj 25 20:17 test.class
-rw-r--r-- 1 seb seb 428 maj 25 20:17 test.java
-rw-r--r-- 1 seb seb 415 maj 25 20:15 test.java~
Removing the ' ' around makes it find nothing at all.
Exchanging * for . makes it work....although my Unix-book says * is any number of characters and . is just one character, as usually is the case, but they also use it with grep/egrep.
So, is Linux different from Unix/Solaris, or am I somehow using this wrong (even though I almost copy the syntax in my Unix course-book).
Thanks
