Page 1 of 1

Go To End Of Files, Delete Blanks ONLY after last Character

Posted: Mon Jul 02, 2007 9:52 pm
by SoloStyl
1000+ files and cant figure it out :(

I need to open all files (including Sub Directories) with extensions like :
*.123 *.abc *.qwerty

In each file, (in the last lines), delete ALL Blank spaces and Carriage Returns ONLY AFTER the last character.

EX: etc etc text text
also text any text <-- last charcter
[Carriage return]
[Carriage return]
[blank line]
[Carriage return]

What i need EX :
EX: etc etc text text
also text any text <-- last charcter

I hope I explained it correctly, If not please post, I'll try to be more specific.

Thanks In Advance, :)

Posted: Mon Jul 02, 2007 10:10 pm
by ben_josephs
There isn't anything in a file after its last character. That's what makes it the last character.

Do you mean you want to delete eveything after the last character that isn't white space?

Does this do what you want?
Find what: \s+\z
Replace with: [nothing]

[X] Regular expression
But that will leave the last line unterminated. To put the terminating newline back in, use
Find what: \s+\z
Replace with: \n

Posted: Mon Jul 02, 2007 10:17 pm
by SoloStyl
WOW! Thanks for the Quickest reply I've ever seen in any forum :)

I'm gonna test what you've posted.

Wish me luck. lol

Posted: Mon Jul 02, 2007 10:28 pm
by SoloStyl
Hrm,

The 1st "Quote" works fine, deletes everything after last character.

The 2nd "Quote" doesnt, it actually ADDS "\n" to the last character.

EX : last char in text\n <-- adds \n to last char

Regular Expresion = Checked

SHould I check in Options " Use POSIX" (maybe not) not sure what all those options mean. Thanks

Posted: Tue Jul 03, 2007 6:41 am
by ben_josephs
Use
[X] Replacement format