9951 explained code solutions for 126 technologies

cli-sedHow do I download and use the CLI version of Sed?

  1. Download the source code for the CLI version of Sed from GNU ftp.
  2. Unpack the source code using your favorite unzip program.
  3. Navigate into the source code directory and run ./configure to configure the program for your system.
  4. Run make to build the program.
  5. Run make install to install the program.
  6. Run sed --help to view the available options for using Sed.
  7. To use Sed, you can run a command such as sed 's/foo/bar/g' foo.txt which will replace all instances of foo with bar in the file foo.txt.

Example code block:

$ sed 's/foo/bar/g' foo.txt

Output of example code:


Code explanation

  • sed: The Sed command.
  • s/foo/bar/g: The substitution command which replaces all instances of foo with bar.
  • foo.txt: The file to apply the substitution to.

Helpful links

Edit this code on GitHub