Skip to content

Instantly share code, notes, and snippets.

@MortezaJavadian
Created September 24, 2025 11:18
Show Gist options
  • Select an option

  • Save MortezaJavadian/990afd9e9a99892f6051b4cc5e476a57 to your computer and use it in GitHub Desktop.

Select an option

Save MortezaJavadian/990afd9e9a99892f6051b4cc5e476a57 to your computer and use it in GitHub Desktop.

Sed CIL Linux

sed stands for Stream Editor.
It is a powerful command-line tool on Linux and macOS. It's main job is to find and change text inside files.

Basic Syntax

sed [OPTIONS] 'SCRIPT' [INPUT_FILE...]
  • OPTIONS: Settings that change how sed works.
  • SCRIPT: The command you want to run and change text.
  • INPUT_FILE: The file you want to read. If you don't provide a file, sed reads from standard input (like a pipe |).

NOTE: If use sed without -i option, only prints the changes and It does not change the original file. you can check your changes at frist.

Saving Your Changes

sed -i 'SCRIPT' [INPUT_FILE...]

NOTE: Your changes saving in the file directly using the -i (--in-place) flag. so be careful to using this.

@parsaM110
Copy link

parsaM110 commented Sep 25, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment