About 523,000 results
Open links in new tab
  1. How exactly do I create a sed script and use it to edit a file?

    To create a sed script, you just give the absolute path to your sed interpreter in your shebang. and make sure the file is executable. or the script could be called along with the sed command. sed -i -f foo file.

  2. Sed Command in Linux/Unix With Examples - GeeksforGeeks

    Apr 11, 2025 · In this guide, we will walk you through the SED command syntax, use cases and most commonly used SED options to help you master this power tool. You’ll also learn how to securely manipulate text, replace strings, delete lines, and automate tasks seamlessly in Linux/Unix environments.

  3. 50 Practical Examples of SED Command in Linux - UbuntuPIT

    Oct 17, 2024 · The below commands demonstrate this using appropriate examples. $ sed -i 's/strawberry/blueberry' input-file $ sed --in-place 's/strawberry/blueberry/' input-file. Both of these above commands are equivalent, and they write the …

  4. Sed Command in Linux with 15 Practical Examples - TecAdmin

    Apr 26, 2025 · In this article, we’ll provide 15 practical examples of using the `sed` command to perform various tasks. Replace Strings Example using Sed 1. Replace string in a file. To replace a string in a file, you can use the 's/old_string/new_string/g' command. The syntax is:

  5. A Practical Guide to GNU sed With Examples - The Valuable Dev

    Jan 27, 2024 · The sed command-line can take two arguments: a sed script and a file. Instead of a file, an input can also be piped to sed. A sed script is composed of three parts: the address, the command, and possibly the command’s options.

  6. Linux Sed Tutorial: Learn Text Editing with Syntax & Examples

    Mar 4, 2025 · Learn sed for powerful text editing. This sed tutorial provides syntax explanations & practical Linux examples for mastering file manipulation

  7. Bash sed Command - Stream Editor - W3Schools

    Example: Script from a File. sed -f script.sed example_text.txt Hello Bash Line 1 Line 2. Specify Line Length. The -l option specifies the line length for the l command, which prints lines with non-printable characters. This option is useful for formatting output when dealing with long lines.

  8. These 10 Sed Examples Will Make You a Linux Power User - MUO

    Command-line utilities like sed allow a user to modify and change the content of a text file right from the terminal window. In this article, we will discuss the sed command in detail, along with …

  9. sed script overview (sed, a stream editor) - GNU

    3.1 sed script overview. A sed program consists of one or more sed commands, passed in by one or more of the -e, -f, --expression, and --file options, or the first non-option argument if zero of these options are used.

  10. sed Command in Linux: A Comprehensive Tutorial with Examples

    Jan 20, 2020 · This example shows the power of sed in manipulating line positions using the hold and pattern spaces. Sed scripts. For complex text processing tasks, you can write sed commands in a script file. This is particularly useful for readability and maintenance when dealing with multiple sed operations.

  11. Some results have been removed