Page 1 of 1

Searching/replacing in the last line of file

Posted: Tue Aug 23, 2011 10:53 am
by fernandocg
Hello, i need help, i want to search and replace in a file but only in the last line of the file, it's posibble??

Many thanks.

Fernando.

Re: Searching/replacing in the last line of file

Posted: Tue Aug 23, 2011 10:29 pm
by Fool4UAnyway
Yes, it's possible.

Use the EOF (End of File) anchor $. Anything before that is definitely on the last line, unless it is an empty line. You might want to use something like matchpattern\r\n$