![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| regexp help | TinCanFury | Shell Programming and Scripting | 0 | 04-06-2008 06:21 PM |
| In Help, Substitute Text ... | solidhelix08 | Shell Programming and Scripting | 6 | 02-07-2008 05:21 AM |
| regexp with sed again!!! | andy2000 | Shell Programming and Scripting | 2 | 05-03-2007 10:15 AM |
| Substitute in vi | kingdbag | UNIX for Dummies Questions & Answers | 5 | 01-17-2007 02:42 PM |
| regexp | penfold | UNIX for Advanced & Expert Users | 1 | 06-28-2005 07:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
vi + regexp + substitute
Another enigma (for me)
Using VI I edit some files in which I want to erase many lines I don't need anymore usually I do something like that: Code:
:%s/line_to_suppress//g but in this case, the pattern to erase contains some special characters so I do it like that: Code:
:%s#line_to_suppress_with_special_characters##g Code:
:%s/*line_to_suppress//g the best way would be to suppress each line containing my pattern, but I don't know how to do that I'm sure it's pretty easy for many among you, so if one have a bit of time, it would help me a lot Thanx |
|
||||
|
Quote:
Code:
blabla 'toto' rep:/titi/toto/ if I understand what you mean, I should do like this: Code:
:%s/^.*blabla\ \'toto\'\ rep\:\/titi\/toto\/// |
|
|||||
|
Quote:
Code:
:%s/^.*blabla 'toto' rep:\/titi\/toto\/// Cheers ZB |
|
||||
|
Quote:
but one more question ![]() it erase the lines, but it doesn't suppress them... any hint? |
|
||||
|
Quote:
xxxxxxxxxxx xxxxxxxxxxx blabla 'toto' rep:/titi/toto/ xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx blabla 'toto' rep:/titi/toto /blabla 'toto' rep:/titi/toto/ xxxxxxxxxxx blabla 'toto' rep:/titi/toto/ blabla 'toto' rep:/titi/toto/ xxxxxxxxxxx File after: xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx Result I wish to have: xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxx ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|