Re: How to fix a 'grep' command from LINUX to UNIX?

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 01/29/04


Date: Thu, 29 Jan 2004 06:07:16 GMT

In article <bva348$pmagv$3@ID-210011.news.uni-berlin.de>,
 "Chris F.A. Johnson" <c.fa.johnson@rogers.com> wrote:

> On Thu, 29 Jan 2004 at 04:39 GMT, William Park wrote:
> > Nuage <khaluaa7@yahoo.com> wrote:
> >> Hello,
> >>
> >> I am having a problem. Could someone help me?
> >>
> >> The following command works in LINUX:
> >>
> >> tail +2 | grep -iv [a-z] /home/usr/...../filefgd.asc >
> >> /home/usr/...../tmp.asc
> >>
> >> It does not work in UNIX:
> >
> > Nonsense. Both will work. By the way, get rid of 'tail' command.
>
> But then he'll get the first line, which he doesn't want.

The first line of what? He didn't give any filenames to the tail
command, so it's going to read from stdin (the terminal if he's entering
these commands interactively). And he *is* giving a filename argument
to grep, so it's going to read that file rather than the output of tail.

Maybe what he meant was:

tail +2 /home/usr/.../filefgd.asc | grep -iv '[a-z]' >
/home/usr/.../tmp.asc

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • tail
    ... I want to write a script that watches a file grow with ... new filenames, and do something with each new file ... because tail does not return until it ...
    (comp.unix.questions)
  • Re: simple grep -v not working
    ... > lines that end in a colon but not if they start with a slash-space. ... When grep gets multiple filenames on the command line, ... the second grep knows nothing of whether the first grep is ...
    (comp.unix.shell)
  • Re: How do I search a file and return matching filenames?
    ... I want the filenames only ... this using either sed or grep. ... print substr ($0, RSTART, RLENGTH) ...
    (comp.unix.shell)
  • Re: shell scripting with solaris, help.
    ... only if filenames don't contain newline characters (which is ... awk can do the job of both grep and wc -l, ...
    (comp.unix.solaris)
  • Re: Finding files containing string
    ... >>> actually give me the filenames anyway. ... >> To see a list of filenames containing the target string: ... > "grep" works recursively, you know. ... Public Key: 0xC8E166BB ...
    (Fedora)