[WBEL-users] grep help
Timothy Nash
tnash1@twcny.rr.com
Tue, 14 Dec 2004 14:27:09 -0500
This is a multi-part message in MIME format.
--------------010907080108030405070400
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
William Hooper wrote:
>Timothy Nash said:
>[snip]
>
>
>>It works for me on my linux box as well. A friend of mine asked me this
>>question - not sure exactly what he's trying to do. I just found out he's
>>using Solaris. Anyone know why Solaris treats periods differently than
>>Linux.
>>
>>
>
>Nope, but...
>
>
>
>>When he issues any of the following commands:
>>
>>
>>grep -w "hostname" hosts
>>grep -w 'hostname' hosts
>>grep -w hostname hosts
>>
>>
>
>These commands are correct to return both lines (and in the original
>example, all 4 lines). The command that works is:
>
>grep hostname$ hosts
>
>This works because the "$" is a metacharacter that means "at the end of a
>line". Perhaps the Solaris grep is a different version?
>
>
>
grep hostname$ hosts returns all 4 entries
grep 'hostname$' hosts returns nothing
grep "hostnmae$" hosts returns nothing
???
--------------010907080108030405070400
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
William Hooper wrote:<br>
<blockquote cite="mid3524.4.124.79.231.1103043090.squirrel@whooper.org"
type="cite">
<pre wrap="">Timothy Nash said:
[snip]
</pre>
<blockquote type="cite">
<pre wrap="">It works for me on my linux box as well. A friend of mine asked me this
question - not sure exactly what he's trying to do. I just found out he's
using Solaris. Anyone know why Solaris treats periods differently than
Linux.
</pre>
</blockquote>
<pre wrap=""><!---->
Nope, but...
</pre>
<blockquote type="cite">
<pre wrap="">When he issues any of the following commands:
grep -w "hostname" hosts
grep -w 'hostname' hosts
grep -w hostname hosts
</pre>
</blockquote>
<pre wrap=""><!---->
These commands are correct to return both lines (and in the original
example, all 4 lines). The command that works is:
grep hostname$ hosts
This works because the "$" is a metacharacter that means "at the end of a
line". Perhaps the Solaris grep is a different version?
</pre>
</blockquote>
grep hostname$ hosts returns all 4 entries<br>
grep 'hostname$' hosts returns nothing<br>
grep "hostnmae$" hosts returns nothing<br>
<br>
???<br>
</body>
</html>
--------------010907080108030405070400--