api: "YAML JSON TOON Database" version: 1.0.0 format: json dataset: slug: sed-reference title: "Sed Reference" description: "Common sed commands, substitutions, and flags." category: "Unix Commands" category_slug: unix-commands tags: "unix,sed,text-processing,stream-editor" view_count: 0 data [8]{pattern,command,description}: Substitute,"sed 's/foo/bar/g' file","Replace all occurrences of foo with bar globally." "In-place edit","sed -i 's/foo/bar/g' file","Edit file in place; use -i.bak for backup." "Delete lines","sed '3d' file","Delete line 3. Use /pattern/d for pattern match." "Print lines","sed -n '5,10p' file","Print lines 5 through 10 only." Insert/append,"sed '3i\\nNew line' file","Insert text before line 3." "Regex group","sed 's/(\\d+)/[\\1]/g'","Capture digits in parentheses and wrap in brackets." "Multiple commands","sed -e 's/a/A/g' -e 's/e/E/g'","Apply multiple substitution commands." "Address range","sed '1,5s/old/new/' file","Substitute only in lines 1 through 5."