vi: deleting lines based on pattern match

vi: deleting lines based on pattern match

Post by Chris Lo » Thu, 25 Jan 2001 09:16:44



Here's a vi question.....

how do i delete all lines containing the pattern "abc"  (exclude quotes)

is this possible with a single vi command??

I tried using---- >  :d/abc

but no luck

 
 
 

vi: deleting lines based on pattern match

Post by the 2nd coming of chris » Fri, 26 Jan 2001 01:15:56


: Here's a vi question.....
: how do i delete all lines containing the pattern "abc"  (exclude quotes)
: is this possible with a single vi command??

why don't you try 'sed /abc/d'

: I tried using---- >  :d/abc

: but no luck

octinomos endemoniado
--
"We've now reached the point where the stuff you can buy over the counter
is stronger than anything you can buy on the street." --Dennis Leary

 
 
 

vi: deleting lines based on pattern match

Post by Mike Dowli » Fri, 26 Jan 2001 01:39:15




>: Here's a vi question.....
>: how do i delete all lines containing the pattern "abc"  (exclude quotes)
>: is this possible with a single vi command??

>why don't you try 'sed /abc/d'

>: I tried using---- >  :d/abc

>: but no luck

From within the vi editor enter

:g/abc/d

Cheers,
Mike

--

address.  It is a mail alias.  Once spammed, the alias is deleted, and
the integer 'N' incremented.  Currently, mike[43,44] are valid.  If
email to mikeN bounces, try mikeN+1.

 
 
 

vi: deleting lines based on pattern match

Post by Chris Lo » Fri, 26 Jan 2001 05:58:51


that did the trick  !

thanks for the help




> >: Here's a vi question.....
> >: how do i delete all lines containing the pattern "abc"  (exclude quotes)
> >: is this possible with a single vi command??

> >why don't you try 'sed /abc/d'

> >: I tried using---- >  :d/abc

> >: but no luck

> From within the vi editor enter

> :g/abc/d

> Cheers,
> Mike

> --

> address.  It is a mail alias.  Once spammed, the alias is deleted, and
> the integer 'N' incremented.  Currently, mike[43,44] are valid.  If
> email to mikeN bounces, try mikeN+1.

 
 
 

1. vi replace second matching pattern in every line - Help Please sorry for double posting

Greetings,

Can some body help  me to replace the second match of a string in every

line in vi
unix, AIX 5L

Sorry for posting under a different topic.  For some reason its going
under a different topic,  I apologize for this.

Moving a bunch of files from one dir to other

mv /u01/oradata/XXXX/file1  /u01/oradata/XXXX/file1
mv /u01/oradata/XXXX/file2  /u01/oradata/XXXX/file2
mv /u02/oradata/XXXXX/file1a /u02/oradata/XXXXX/file1a
mv /u09/oradata/XXXX/file2a /u09/oradata/XXXX/file2a

I want to replace the 2nd XXXX to YYYYY

Regards & Thanks
BN

2. Looking for tools SHA1, port equivalent of lsof (Solaris)

3. Matching Line After Pattern (Pattern Occurs Multiple Times)

4. ext2fs CRASH help!

5. Matching a pattern in a file and inserting variable string above the line matched?

6. IP routing table lookup in FreeBSD..

7. Pattern matching and extracting the data which matches the pattern

8. man command

9. grepping for pattern, and then deleting ALL the following lines after the pattern

10. inserting lines before and after lines with matching pattern using sed?

11. Deleting multplie lines after matching a regex in the first line

12. Find a string, delete that line, delete 1 line before it and all lines after it...

13. Sed/VI pattern matching