• Latest
  • Trending
  • All
sed Command Generator: Build Substitute, Delete and Print Commands - cover image

sed Command Generator: Build Substitute, Delete and Print Commands

May 31, 2026
Maximizing Website Speed with Image Optimization Techniques for 2026 - cover image

Maximizing Website Speed with Image Optimization Techniques for 2026

June 3, 2026
SSL certificate renewal manager - 8 ACME clients, expiry calculator and monitoring - cover image

SSL Certificate Renewal Manager: certbot, acme.sh, lego, Caddy, cert-manager

June 3, 2026
CORS policy generator - 14 server and framework configs with presets and live security review - cover image

CORS Policy Generator: Headers + Nginx, Apache, Express, FastAPI, Django Config

June 3, 2026
netsh wlan command reference - 72 commands with example output and copy - cover image

netsh wlan Commands: Windows Wi-Fi Cheat Sheet (Show Password, Profiles, Hotspot)

June 2, 2026
Fix: ESXi Host Not Responding / Disconnected in vCenter (2026) - cover image

Fix: ESXi Host Not Responding / Disconnected in vCenter (2026)

June 1, 2026
VMware ESXi Purple Screen of Death (PSOD): Diagnose and Recover (2026) - cover image

VMware ESXi Purple Screen of Death (PSOD): Diagnose and Recover (2026)

June 1, 2026
VMware PowerCLI command generator cover

VMware PowerCLI Command Generator: VM, Snapshots, Networking, esxcli

June 1, 2026
dd Command Generator: Write ISO to USB, Image Disks, Wipe Drives - cover image

dd Command Generator: Write ISO to USB, Image Disks, Wipe Drives

June 1, 2026
SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding - cover image

SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding

June 1, 2026
VMware Workstation and Hyper-V on the Same Machine (2026 Fix) - cover image

VMware Workstation and Hyper-V on the Same Machine (2026 Fix)

May 31, 2026
VMware ESXi error reference - 70 errors with fixes - cover image

VMware ESXi Error Reference: Searchable Fix Database (PSOD, APD, vMotion)

June 1, 2026
systemd Service File Generator: Create .service and .timer Units - cover image

systemd Service File Generator: Create .service and .timer Units

May 31, 2026
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools
Wednesday, June 3, 2026
  • Login
People Are Geek
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools
No Result
View All Result
People Are Geek
No Result
View All Result
Home Developer Tools

sed Command Generator: Build Substitute, Delete and Print Commands

by People Are Geek
May 31, 2026
in Developer Tools, Online Tools
0
sed Command Generator: Build Substitute, Delete and Print Commands - cover image
0
SHARES
4
VIEWS
Share on FacebookShare on Twitter

sed command generator

Build a sed command for the common stream-editing jobs: substitute text, delete lines, print a range or insert content. Pick the operation, set the pattern and any line addressing, and decide whether to edit the file in place. The command updates live with every part explained, and a warning appears whenever you enable in-place editing. Assembled entirely in your browser.

$

What this sed command generator does

sed, the stream editor, transforms text line by line as it flows from input to output. It is the fastest way to substitute strings, delete or print specific lines, and make scripted edits to config files. Its mini-language is terse: a one-letter command, an optional address that selects which lines, and flags. That density makes sed powerful and easy to get wrong, especially the in-place -i flag that rewrites the file. This generator builds the command from plain choices and explains each piece.

The general shape is sed '[address]command' file. The address selects lines (a number, a range like 10,20, or a /regex/); leave it empty to act on every line. The command is the operation: s for substitute, d for delete, p for print, i and a for insert and append. The substitute command takes its own form, s/find/replace/flags, where g replaces every match on a line rather than just the first.

The operations you will use most

GoalCommand
Replace all “foo” with “bar”sed 's/foo/bar/g' file
Replace only on lines 10-20sed '10,20s/foo/bar/g' file
Delete blank linessed '/^$/d' file
Delete line 3sed '3d' file
Print only lines 5-10sed -n '5,10p' file
Edit the file in placesed -i 's/foo/bar/g' file

In-place editing and backups

By default sed prints the result to standard output and leaves the file untouched, which is the safe way to preview a change. Adding -i rewrites the file directly. Because that is irreversible, GNU sed lets you keep a safety copy by attaching a suffix: -i.bak writes the edited file and saves the original as file.bak. Always run the command once without -i to confirm the output, then add the flag. On macOS and BSD, -i requires an explicit suffix argument, even an empty one (-i ''), which is a common portability gotcha.

Regex and delimiters

The find pattern is a basic regular expression by default; add the right escaping or use -E for extended regex. When your pattern or replacement contains slashes, such as a file path, switch the delimiter: sed accepts any character after s, so s|/old/path|/new/path|g avoids escaping every slash. This generator switches the delimiter automatically when it detects a slash in your text, keeping the command readable.

Privacy and how this tool runs

The command is built by JavaScript in your browser. No patterns, replacements or file names are sent anywhere or logged. You can use the generator offline once the page has loaded.

Frequently asked questions

How do I replace text in a file with sed?

Use sed 's/old/new/g' file to print the result, or sed -i 's/old/new/g' file to edit the file in place. The trailing g replaces every occurrence on each line; without it only the first match per line changes.

What does the g flag do?

By default the substitute command replaces only the first match on each line. The g (global) flag makes it replace every match on the line. To replace from the second match onward, combine a number with g, for example s/a/b/2g.

How do I delete lines matching a pattern?

Use the delete command with a pattern address: sed '/pattern/d' file removes every line containing the pattern. sed '/^$/d' removes blank lines, and sed '3d' removes line 3. Add -i to apply the deletion to the file.

How do I edit a file in place safely?

Run the command first without -i to preview the output. When it looks right, add -i.bak so sed edits the file and keeps the original as file.bak. On macOS or BSD sed, the suffix is mandatory; use -i '' for no backup.

How do I print only specific lines?

Combine -n (suppress automatic printing) with the print command and an address: sed -n '5,10p' file prints lines 5 through 10. Without -n every line would print and the matched ones would print twice.

When should I use awk instead of sed?

Use sed for line-oriented substitutions, deletions and simple edits. Reach for awk when you need to work with fields and columns, do arithmetic, or apply conditional logic across records. They complement each other; many pipelines use sed to clean text and awk to extract or compute.

Related tools and resources

More command builders from the same toolkit.

find Command Generator tar Command Generator rsync Command Generator chmod Calculator Common Ports List
ShareTweetPin
People Are Geek

People Are Geek

People Are Geek

Copyright © 2017 JNews.

Navigate Site

  • About PeopleAreGeek
  • All Tools and Articles
  • Contact
  • Cookie Policy
  • Hyper-V Hub: Tools, Error Fixes and Lab Guides
  • Linux Hub: Cross-Distro Reference, Articles, Tools
  • Page de test Codex
  • Privacy Policy
  • Sample Page
  • Terms of Service
  • VMware vSphere & ESXi Hub: Tools, Error Fixes and Guides

Follow Us

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools

Copyright © 2017 JNews.