sed
  english  
 
Difino
sed (which stands for Stream EDitor) is a simple but powerful computer program used to apply various pre-specified textual transformations to a sequential stream of text data. It reads input files line by line, edits each line according to rules specified in its simple language (the sed script), and then outputs the line. While originally created as a UNIX utility by Lee E. McMahon of Bell Labs in 1973/1974, sed is now available for virtually every operating system that supports a command line.
sed is often thought of as a non-interactive text editor. It differs from conventional text editors in that the processing of the two inputs is inverted. Instead of iterating once through a list of edit commands applying each one to the whole text file in memory, sed iterates once through the text file applying the whole list of edit commands to each line. Because only one line at a time is in memory, sed can process text files with an arbitrarily-large number of lines. Some implementations of sed can only process lines of limited lengths.
sed's command set is modeled after the ed editor, and most commands work similarly in this inverted paradigm. For example, the command 25d means if this is line 25, then delete (don't output) it, rather than go to line 25 and delete it as it does in ed. The notable exception is the copy and move commands, which span a range of lines and thus don't have straightforward equivalents in sed. Instead, sed introduces an extra buffer called the hold space, and additional commands to manipulate it. The ed command to copy line 25 to line 76 (25t76) for example would be coded as two separate commands in sed (25h; 76g), to store the line in the hold space until the point at which it should be retrieved.
The following example shows a typical usage of sed:sed -e 's/oldstuff/newstuff/g' inputFileName > outputFileName
The s stands for substitute; the g stands for global, which means that all matching occurrences in the line would be replaced. After the first slash is the regular expression to search for and after the second slash is the expression to replace it with. The substitute command (s///) is by far the most powerful and most commonly use
Source: [wikipedia: sed]






alebrije.info   :   alebrijes   :   sites   :   advertising   :   link to us   :   contact



 

Newsgroups
  alt.comp.editors.batch


Specialized stores
  Amazon.com (US)
  Amazon.ca (CA)
  Amazon.co.uk (UK)

Specialized search
  Discovery.com
  Exploratorium
  TutorialFind

General crawlers
  All the Web
  AltaVista
  Google
  Lycos
  Mamma
  Msn
  Overture
  Teoma
  WiseNut

All contents Copyright © 2001-2008 by Alebrije.info and Grupo JOAL. All Rights Reserved.