Help: a vi question

Help: a vi question

Post by charlie » Wed, 25 Sep 2002 12:04:21



Hi, folks

I have a file like this
------------
REM  aaaaa
REM  bbbb
ccccccc
------------
In vi, or in perl, whatever it works, how can I remove all the lines start
with REM?

Thanks for  your help

 
 
 

Help: a vi question

Post by Dan » Wed, 25 Sep 2002 12:08:10




Quote:> Hi, folks

> I have a file like this
> ------------
> REM  aaaaa
> REM  bbbb
> ccccccc
> ------------
> In vi, or in perl, whatever it works, how can I remove all the lines start
> with REM?

> Thanks for  your help

I am sure you will get great complicated answers.  Here is my grep version

grep  -v   ^REM    file_original > file_new

 
 
 

Help: a vi question

Post by Al Shark » Wed, 25 Sep 2002 12:58:59



> Hi, folks

> I have a file like this
> ------------
> REM  aaaaa
> REM  bbbb
> ccccccc
> ------------
> In vi, or in perl, whatever it works, how can I remove all the lines
> start with REM?

In vi:

:g/^REM/d

 
 
 

Help: a vi question

Post by those who know me have no need of my nam » Wed, 25 Sep 2002 12:55:32


in comp.unix.questions i read:

Quote:>In vi, or in perl, whatever it works, how can I remove all the lines start
>with REM?

vi: g/^REM\s/d
perl: perl -i -n -e 'print unless /^REM\s/' file

notes:
by default these commands are case-sensitive.
drop the \s if lines like `REMxxxx' should also be deleted.
your vi may not grok \s, in which case you can replace it with `[ ^I]'.
`^I' should be interpreted as a single `tab' character.

--
bringing you boring signatures for 17 years

 
 
 

Help: a vi question

Post by Dan Logche » Wed, 25 Sep 2002 23:00:02



Quote:> in comp.unix.questions i read:

> >In vi, or in perl, whatever it works, how can I remove all the lines start
> >with REM?

> vi: g/^REM\s/d
> perl: perl -i -n -e 'print unless /^REM\s/' file

> notes:
> by default these commands are case-sensitive.
> drop the \s if lines like `REMxxxx' should also be deleted.
> your vi may not grok \s, in which case you can replace it with `[ ^I]'.
> `^I' should be interpreted as a single `tab' character.

I wonder how much homework we're doing for people here..
I mean, since when has REM been used???

--
Dan

 
 
 

Help: a vi question

Post by those who know me have no need of my nam » Thu, 26 Sep 2002 02:29:17


in comp.unix.questions i read:

Quote:>I wonder how much homework we're doing for people here..

lots.

--
bringing you boring signatures for 17 years

 
 
 

Help: a vi question

Post by mats.blomstr.. » Fri, 27 Sep 2002 16:45:28


Quote:>>I wonder how much homework we're doing for people here..
> lots.

Yes probably. But i dont think its bad that we help them with these
silly-simple questions about UNIX elementary things.

When they see the answer to their question they realize that
they asked a not-so-bright thing.
1) They will see that there is solution to their 'impossible' problem.
2) They will see in the answer that it was not hard to come up with
   for the 'provider'.
3) They come to realize that they could have done it by them self, so
   when the next question comes up they will try a minute more before
   they give up and cry for help :)

Well, that is what i would like to think is going on anyway. Perhaps
im naive.

Actually, i dont care since i make a dollar out of it anyhow.
Thinking up solutions for these question is helping me more than
it helps them. It helps me to wrap up these basic skills in concrete.
Very useful!
Gradually one will build up skills, and at some point
some questions will be to easy. Just leave them for the 'younger-
generation-newbie-helper' to answer.

Its a win-win situation. Although one wonders about some questions though :)
//Mats