I'm sure this is easy but I can't figure out how to do it.
I want to use AFR to delete the last line of a few thousand text files but I don't know what regular expression to use to select the last line - the last lines don't necessarily end with line breaks.
Thanks
			
			
									
						
										
						Deleting last line in files
Re: Deleting last line in files
Go to main menu - Action - Options - Batch Replace
check "Modifier S"
check "Modifier G"
Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
\A(.*)\r\n.*\r?\n?\Z
Replace with:
$1
That's all I verified it works perfectly.
Note: in this example we use line breaks used in Windows (\r\n)
Otherwise you should use search for: \A(.*)\n.*\n?\Z
			
			
									
						
										
						check "Modifier S"
check "Modifier G"
Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
\A(.*)\r\n.*\r?\n?\Z
Replace with:
$1
That's all I verified it works perfectly.
Note: in this example we use line breaks used in Windows (\r\n)
Otherwise you should use search for: \A(.*)\n.*\n?\Z
Re: Deleting last line in files
Thank you Roman - that works great.  
			
			
									
						
										
						- 
				digitalmonkeyman
 - Posts: 4
 - Joined: Sun Sep 16, 2007 7:35 am
 
Re: Deleting last line in files
solution received
Thanks
			
			
									
						
										
						Thanks