sed (utility)

sed is an Linux utility or command that can be used to replace string by another string.

Examples

Basic syntax

1
sed -i 's/old-word/new-word/g' *.md

Troubleshooting

sed: 1: “something…": invalid command code W

Try adding the -e argument explicitly and giving '' as argument to -i:

1
sed -i '' -e 's/..\/src\/components/..\/components/g' *.mdx

sed: content: in-place editing only works for regular files

1
sed -i '' -e "s/oldstr/newstr/g"  `find .* -type f -maxdepth 0 -print`

Subscribe to the newsletter

Get a once-per-week email with my latest content. By subscribing to this newsletter you will also be the first to receive last updates of my eBooks and courses.

0 members

Comments 💬