Sed

Linux Sed Examples for Branching OperationsThis article is part of the on-going Unix Sed Tips and Tricks series.

Like any other programming language, sed also provides special branching commands to control the flow of the program.

In this article, let us review following two types of Sed branching.

  1. Sed Unconditional Branch
  2. Sed Conditional Branch

(more…)

Linux Sed Command ExamplesThis article is part of the on-going Unix Sed Tips and Tricks series.

In our previous sed articles we learned — sed printing, sed deletion, sed substitute , sed file write, sed multiple commands, sed multi-line operation, and sed manipulate file lines.

In our first part of sed tutorial we learned that sed has two buffers — sed pattern buffer and sed hold buffer. So far we have talked only about pattern buffer.

In this article let us review how to use sed hold and pattern buffer using 7 practical sed examples.

(more…)

Linux Sed Examples for Multiple File Line OperationsAs part of our on going UNIX sed tutorial series earlier we covered the printing, deletion, substitution, file write, file manipulation commands etc., with the single line in the pattern space.

In this article let us review how to do the multi-line operation in Sed.

(more…)

Linux Sed Examples - File Manipulation CommandsThis article is part of the on going Unix sed command tutorial series. In our previous articles we learned sed with single commands — printing, deletion, substitute and file write.

Sed provides lot of commands to perform number of operations with the lines in a file.

In this article let us review how to append, insert, replace a line in a file and how to get line numbers of a file.

(more…)

Linux Sed Examples - Advanced Find and Replace OperationThis article is part of the on-going Unix Sed Tips and Tricks series.

In our previous sed articles we learned — sed printing, sed deletion, sed substitute , sed file write, and sed multiple commands.

In this article, let us review some interesting workarounds with the “s” substitute command in sed with several practical examples.

(more…)

Question: Is it possible for me to combine multiple sed commands? Can I combine two sed commands and execute it as single sed command?

Answer: In our previous articles we learned sed with single commands — printing, deletion, substitute and file write.

In this article let us review how to combine multiple sed commands using option -e as shown below.

(more…)

Sed Examples for writing to a file on LinuxThis article is part of Unix Sed Tutorial series. In previous articles, we discussed about sed print operation , sed delete operation and sed find and replace.

In this article, let us review how to extract part of one file and write it to another file using sed.

(more…)

Sed Examples for Unix and Linux - Find and ReplaceThis article is part of on-going Unix Sed Tutorial series. In previous articles, we discussed about sed print operation and sed delete operation.

In this article let us review how to use sed substitute command “s”.

The `s’ command is probably the most important in `sed’ and has a lot of different options.

(more…)