Jeanne

That looks more like a Unix command than a Perl one - is this a perl script
or a unix one? Assuming it's perl, grep needs two arguments, the search term
and a list to search in, you can't pipe in the file like you can in unix and
cat doesn't work either.

I don't know much about perl grep, personally I would do this a different
(and hopefully more Perlish) way, like so:

        open INPUT, $CHECKIN_FILENAME; # open the file in $CHECKIN_FILENAME
into 
                                       # the filehandle INPUT
        open FNAME, ">grepoutput.txt");
        while (<INPUT>) {     # Go through your input file line by line
          print FNAME if /\cM/g   # and print to FNAME if it finds ^M
        }

Cheers

Mark C

> -----Original Message-----
> From: Jeanne Riley [mailto:[EMAIL PROTECTED]]
> Sent: 22 June 2001 11:21
> To: '[EMAIL PROTECTED]'
> Subject: Pipe grep output to file
> 
> 
> Hi,
> 
> I need to detect ^M(s) in a file and send the output to a file.  I am
> extremely new to Perl.  This is what I have which incidentally is not
> working...
> 
> open(FNAME,">grepoutput.txt");
> cat $CHECKIN_FILENAME | grep "/\cM/g" >FNAME;
> 
> The error message I get is that there are not enough 
> arguments to grep.
> 
> Thanks,
> Jeanne
> 
> 
> 

Reply via email to