Finding strings and placing into new file

Find, replace, find in files, replace in files, regular expressions

Finding strings and placing into new file

Postby stevef » Thu Jul 29, 2004 12:54 pm

I tried searching for a string that I defined in "Find in files". I was able to find it (having multiple occurances) and I would like to send the results to a new file. However, when I turn on "Results to edit window" (so I can save the results) it sends the full path of the file to the edit window as well as the search string data. The bottom line is I only the actual data defined by my search in my new file, not other misc information.

Help. I am new to this.

Thanks
Steve

:?:
User avatar
stevef
Newbie
 
Posts: 2
Joined: Wed Jul 28, 2004 11:00 pm

Re: Finding strings and placing into new file

Postby mrainey56 » Thu Jul 29, 2004 1:50 pm

Hi, and welcome.

This macro looks okay on my system. Just run it after you have the search results displayed. If you don't like the results, say something and we'll get it right.

Make sure you check the "Continue if a Find With Replace Not Found" box when you create the macro.




InsertMode
ColumnModeOff
HexOff
UnixReOn
Top
Find RegExp "^[A-Z][:].+[:] "
Replace All ""
Top
Find RegExp "^Find.+\p"
Replace All ""
Top
Find RegExp "^Found.+\p"
Replace All ""
Top
Find RegExp "^Search.+\p"
Replace All ""
Top
Find RegExp "^----.+\p"
Replace All ""
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina

Re: Finding strings and placing into new file

Postby stevef » Thu Jul 29, 2004 3:23 pm

I get an error message when I try to close and update the macro. "Incorrect macro command in macroline". I did see in your response the line: Find RegExp "^[A-Z][:].+[:] " has a space between the last [:] and the end quote. So, I did try changing it to Find RegExp "^[A-Z][:].+[:]" instead. This had no effect. I am on version 10.20b if that makes any difference.

Thanks

Steve
User avatar
stevef
Newbie
 
Posts: 2
Joined: Wed Jul 28, 2004 11:00 pm

Re: Finding strings and placing into new file

Postby mrainey56 » Thu Jul 29, 2004 5:50 pm

You've run into the "extra blank line at the end of the macro" error. :D
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina


Return to Find/Replace/Regular Expressions