ehime
ehime

Reputation: 8405

Xargs SED back into same file?

Lets say I hit foo.html with find, i would like to pipe the contents back into foo.html

find . -iregex '.*\(html\|htm\)' -printf '%P\0' | \
xargs -0 sed -Ee "s:(http|https)\://(www.|)${domain}[?/]::g" \
> # to what? {\} ???

Right now it does not know what or where its

Upvotes: 0

Views: 876

Answers (1)

pobrelkey
pobrelkey

Reputation: 5973

Pass the -i flag to sed, then it will modify the input file in place.

find . -iregex '.*html?' -printf '%P\0' | xargs -0 sed -i -Ee "s:(http|https)\://(www.|)${domain}[?/]::g"

Upvotes: 1

Related Questions