Jump to content
Macro Express Forums

Delete Whole Lines In A Text File


yaqwa

Recommended Posts

how can i do this

 

I have a text file from a server log and just want to delete all lines where my own ip was included (for better view)

 

by example

 

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0"

127.0.0.1 - - [14/Jun/2005:12:34:55 +0200] "GET /p.....

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0"

127.0.0.1 - - [14/Jun/2005:12:34:55 +0200] "GET /p.....

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0"

127.0.0.1 - - [14/Jun/2005:12:34:55 +0200] "GET /p.....

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0"

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0" 

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0" 

64.12.116.67 - - [14/Jun/2005:10:45:51 +0200] "GET /g... HTTP/1.0" 

127.0.0.1 - - [14/Jun/2005:12:34:55 +0200] "GET /p.....

 

 

I want to do this with a macro

 

1.copy the log file to a new file (server.log --------> view.txt)

2.than delete all lines where 127.0.0.1 is at the beginning of each line

3.open that file for me to see

 

thats all

 

I know how to copy and open but i do not know how to delete those lines

please help

Link to comment
Share on other sites

Use the Text File Begin/End Process commands.

Text File Begin Process: "test.txt"
 If Variable %T1% does not contain "127.0.0.1"
   Variable Modify String: Append %T1% to Text File
 End If
Text File End Process

<BTFBEG:001:000001:000000:c:\test.txt><IFVAR2:1:01:8:127.0.0.1><TMVAR2:20:01:00:000:000:c:\output.txtT><ENDIF><BTFEND>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...