I have a file which each line that ends with Mar 15, 2013
and other dates so I need to remove the end of each line say the last 13 characters
Each line
You can use a regular expression in the search and replace
-dialog (Ctrl
+H
) that is anchored to the end of the line:
.{13}$
Then replace it with nothing. And of course you could use a more expressive regex to match only dates in your particular format and nothing else.
As others already said, use a regex search in the search and replace dialogue (ctrl + h) with the pattern the dates follow. Given your example this should do:
[A-Za-z]{3}\s(\d){1,2},\s?\d{4}$
Replace with empty string.
Just to give you an alternative. You can also use the column edit mode.
Press Alt
and Left click
your mouse and move your mouse vertically over all the lines that you want to edit. Then you can just delete everything starting from that column.
EDIT. On second look I see that you mentioned the lines are of different length. So this might not work in your case. Anyways I will leave it as it is. Who knows it might come in handy later, or maybe for someone else.