How to Use TreesedGo to the directory where you want to search or make changes.There are two choices you can make when using treesed:
SearchingSay you are faced with the situation that the author of a slew of web-pages, Nathan Brazil, has left and has been succeeded by Mavra Chang. First, let us see which files are affected by this (what you type in is shown in bold):We notice the following:[localhost] treesed "Nathan Brazil" -files *.html search_pattern: Nathan\ Brazil replacement_pattern: ** Search mode . midnight.html: 1 lines on: 2 .. well.html: 1 lines on: 3
We notice the following:[localhost] treesed "Nathan Brazil" -tree search_pattern: Nathan\ Brazil replacement_pattern: ** Search mode . midnight.html: 1 lines on: 2 ... well.html: 1 lines on: 3 . new/echoes.html: 1 lines on: 2
ReplacingTo replace a text you simply add the replacement text right after the search text:We notice the following:[localhost] treesed "Nathan Brazil" "Mavra Change" -files *.html search_pattern: Nathan\ Brazil replacement_pattern: Mavra Chang ** EDIT MODE! . midnight.html: 1 lines on: 2 Replaced Nathan\ Brazil by Mavra Chang on 1 lines in midnight.html .. well.html: 1 lines on: 3 Replaced Nathan\ Brazil by Mavra Chang on 1 lines in well.html
and we get the expected results, including the replace in new/echoes.html.[localhost] treesed "Nathan Brazil" "Mavra Chang" -tree search_pattern: Nathan\ Brazil replacement_pattern: Mavra Chang ** EDIT MODE! . midnight.html: 1 lines on: 2 Replaced Nathan\ Brazil by Mavra Chang on 1 lines in midnight.html .... well.html: 1 lines on: 3 Replaced Nathan\ Brazil by Mavra Chang on 1 lines in well.html . new/echoes.html: 1 lines on: 2 Replaced Nathan\ Brazil by Mavra Chang on 1 lines in new/echoes.html Old VersionsTreesed leaves behind quite a mess of old versions of the files it changed (only in change-mode, of course). These old files have the same name as the original file, with .ddddd appended to it. For example, if treesed makes a change to midnight.html it will leave the original version as something like midnight.html.26299. You'll have to remove these files lest your disk area clutters up. Here is a command that does that, but beware! This command removes all files in the current directory and all below it, that end in a period followed by one or more digits:It is interesting to note that if you use treesed again without cleaning up, you may get files like midnight.html.26299.27654. These will also be cleaned up by the above slightly dangerous command.find . -name "*.[0-9]*" -exec rm {} \; About Treesedtreesed is public domain software developed and designed by Rick Jansen from Sara, Amsterdam, Netherlands, January 1996.
About This DocumentThis usage document was created by the Division of Information Technology Services at The University of Western Ontario. |