Skip to main content
InterviewHubPRO
Section Overview
Q22

Question 22 of 50

Part 3: Advanced Text Processing & Production Internals (Senior / Lead)

44%
Bash & Shell Scripting (50 Qs)•Part 3: Advanced Text Processing & Production Internals (Senior / Lead)

How does `sed` (Stream Editor) work for find & replace in files?

senior Levelbash-shellAdvanced Text Processing

In Simple Words: sed performs basic text transformations on an input stream or file:

  • Syntax: sed 's/search_pattern/replacement/flags'
  • Flags: g (global - replace all occurrences per line), i (case-insensitive).
  • In-Place Editing (-i): Modifies the file directly on disk (sed -i 's/localhost/10.0.0.1/g' config.env).
  • Custom delimiters: Use # or | when replacing paths containing slashes: sed -i 's#/var/www/html#/srv/app#g' nginx.conf.