Page 1 of 1

Wipe off the text after a certain keyword

Posted: Sat Jul 04, 2009 2:24 am
by nvedia
I have a file with these lines

+ G G Dandekar Machine B 69.05 76.05 + 10.14
+ Meghmani Organics Lt B 13.00 14.30 + 10.00
+ Nagpur Power B 35.00 38.50 + 10.00
+ Geodesic Ltd B 96.35 105.90 + 9.91
+ Roselabs Industries B 10.80 11.75 + 8.80

What I want to do is that wherever I am getting " B " I want to replace the text after that(including B)
so that the final file looks like this

+ G G Dandekar Machine
+ Meghmani Organics Lt
+ Nagpur Power
+ Geodesic Ltd
+ Roselabs Industries B 10.80 11.75 + 8.80

How can this be achieved?
Thanks

Posted: Sat Jul 04, 2009 5:57 am
by MudGuard
The problem will be the last line.
It is probably easiest to copy that line to the clipboard, then do the replacement (see below), then add the line from the clipboard again.

For the replacement:

Find

Code: Select all

_B_.*
(use space where I put underscores)
Replace with nothing

(regex checked).[/code]

Posted: Sat Jul 04, 2009 7:25 am
by nvedia
Thanks
When i give that I get this
Cannot find regular expression
_B_.*

Posted: Sat Jul 04, 2009 7:42 am
by MudGuard
you saw that I wrote "(use space where I put underscores) "?

Posted: Sat Jul 04, 2009 7:56 am
by nvedia
Thanks it works :)

PS: Sorry I am feeling sleepy so overlooked it :(

Posted: Sat Jul 04, 2009 3:08 pm
by Bob Hansen
I think this takes care of the last line automatically...

Search for: _B_.*\n\+
Replace with \n\+

Again, using _ for a space character
Use Regular Expressions and POSIX syntax