Newbe to grep

Newbe to grep

Post by wesl » Thu, 07 Nov 2002 09:48:14



Hello
I'm trying to use grep to display file names with .html extension but
they do not start with letters "d" to "p" in directory /usr4

In the second process I'm trying to use grep to find number of files
in the /usr4 directory that contain a "period" (.) in their names.

My next question is using grep utility How would you find the total
number of files in the /usr directory

Thanks for any help to those who respond to my questions.

Wesley

 
 
 

Newbe to grep

Post by Andreas K?h?r » Thu, 07 Nov 2002 10:02:46


Submitted by "wesley" to comp.unix.admin:

Quote:> Hello
> I'm trying to use grep to display file names with .html extension but
> they do not start with letters "d" to "p" in directory /usr4

> In the second process I'm trying to use grep to find number of files
> in the /usr4 directory that contain a "period" (.) in their names.

> My next question is using grep utility How would you find the total
> number of files in the /usr directory

> Thanks for any help to those who respond to my questions.

> Wesley

That's an unusually boring homework assignment.

Read the manual pages for ls and grep ("man ls", "man grep").
Combine them for the first two tasks.  The third task is, IMO,
best solved with find and wc (see their manuals).

--
Andreas K?h?ri               --==::{ Have a Unix: netbsd.org
                             --==::{ This post ends with :wq

 
 
 

Newbe to grep

Post by Daniele Di Matti » Wed, 13 Nov 2002 20:45:45



Quote:> Hello
> I'm trying to use grep to display file names with .html extension but
> they do not start with letters "d" to "p" in directory /usr4

I use bash

daniele$ ls
a       b       c       da.htm  pa.htm  zz.htm
aa.htm  ba.htm  d       p       z
daniele$ ls [!dp]*.htm
aa.htm  ba.htm  zz.htm

Quote:> In the second process I'm trying to use grep to find number of files
> in the /usr4 directory that contain a "period" (.) in their names.

daniele:prova$ls *.*
aa.htm  ba.htm  da.htm  pa.htm  zz.htm

Quote:> My next question is using grep utility How would you find the total
> number of files in the /usr directory

daniele$ ls|wc -l
      11

Hi

 
 
 

1. grep sTerm * | grep -v grep ???

in .bashrc

alias r='ps ax | grep $1 | grep -v grep'

this works from the command line but doesn't work from the bashrc.
Apparently there's a syntax problem.

...and

. filename

where can I read about this commad that is found in bash and sh
scripts?  I searched the bash and one or two other man pgs to no
avail.  Thanks gurus.

--


2. Simple curses application wanted.

3. tail | grep | grep | grep

4. pop3/imap problem

5. How to make grep select both lines using only a single 'grep' command

6. Resume print job from other user

7. grep question New to grep

8. HFS+

9. grep octal value (grep '\0145' /tmp/test) doesn't work !!

10. Bug in grep or man grep

11. lscfg | grep en and then grep lo

12. PLEASE HELP A NEWBIE: grep doesn't grep

13. grep attempts to grep in non-ascii files