SED examples

Posted: April 15, 2016 in Linux
Tags:

sed -i '/^#/d' vendor/broadcom/hammerhead/device-partial.mk #remove all lines beginning with #

sed -i '1,2d' vendor/broadcom/hammerhead/device-partial.mk #delete 1st 2 lines

sed -i 's_:broadcom \\_ _g' vendor/broadcom/hammerhead/device-partial.mk #replace :broadcom \ with a space

sed -i 's_:system_ system_g' vendor/broadcom/hammerhead/device-partial.mk #replace :system with system

sed -i 's_ vendor/_install -D -m 644 vendor/_g' vendor/broadcom/hammerhead/device-partial.mk #replace vendor/ with install -D -m 644 vendor/

sed '1 i\#!/bin/bash' vendor/broadcom/hammerhead/device-partial.mk #add #!/bin/bash to 1st line

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s