|
|
|
|
sed for Not Yet Techies"Computer Careers: Editing Files on Unix With This Powerful Tool"by Richard Stooker, President Info Ring Press and author of Secrets of Changing to a Computer Career |
|
sed is a powerful UNIX utility for editing text files. sed is especially useful for such functions as "search and replace" across many files. It is a non-interactive, stream-oriented editor. sed uses pattern matching and has been available since the 7th version of the operating system, or UNIX V7. It is available for download from the Free Software Foundation web site. It evolved from the old line text editor, ed. Yes, I know that sounds like bad poetry but there it is. sed scripts are invoked from a UNIX shell wrapperLet's say you've just written a novel. Each chapter is a separate text file. After you've written Chapter 50, you decide to change the name of the main character. You originally named your character Charlie Brown. Then you discover that is already the name of a famous comic strip character in Peanuts, and you don't want people thinking your character is a loser, so you decide to rename him Charles Atlas. Any decent text editor today will have a search and replace function. But they normally don't cover multiple files at once. They apply to the file you happen to have open. So you would have to open up all 50 chapters, one file after another , and run Search and Replace on each separate chapter. It could take well over an hour and be very boring. I've done this with long works of my own. Now, sed to the rescue, if you're using UNIXUse sed to run Search and Replace on all 50 text files at once, and you're done. Charlie Brown is now Charles Atlas and none of your readers will ever know his original name. Next: Small Business Server |
|
Use Your New Computer Career as a Stepping Stone to Even Greater SuccessSend off for your free 7-part Techie Plus eCourse now. So that you can learn:
It's fast and easy. You will receive the first part in your email box within minutes. I respect your privacy. I will never sell, rent or trade your email address. After you subscribe, the form will redirect you to a thank you page. Thank you! Rick Stooker |
|
Permission is granted to reprint the above article in an ezine or on a website as long as it is reprinted in full, with no changes, with full credit and with this contact information and link included at the bottom. All other rights reserved. Copyright 2007 by Info Ring Press All Rights Reserved. Computer Careers (Home) Sitemap Contact Privacy Info Ring Press Richard Stooker PO Box 617 130-G Ballwin Manor Dr Ballwin, MO 63011 (636) 394-2052 rick@inforingpress.com |