1834168 Members
2263 Online
110064 Solutions
New Discussion

Re: script

 
Reggie Chang
Frequent Advisor

script

Hi there,

I'm writing a C-Shell script and need to find out
if a file_x has certain pattern, which appears
once (or none) in a particular file.

I tried to use grep but cannot do the following:
set file_name = file_x
set num = grep pattern_x $file_name | wc -l
if ( $num == 1 ) then
.
.

Any suggestion is appreciated.

Reggie

3 REPLIES 3
Hein van den Heuvel
Honored Contributor

Re: script



simply use: grep -c ?!

Hein.


Reggie Chang
Frequent Advisor

Re: script

Hein,

Thank you for the info.

I think the real problem is to use grep with
set. Using grep -c would be easier, but set
does not work.

Reggie
Reggie Chang
Frequent Advisor

Re: script

Hein,

I got the solution.
set par = `grep ........` is the way.

Thank you.

Reggie