Tail a log and replace according to a sed pattern

tail -F logfile|while read l; do sed 's/find/replace/g' <<< $l; done
Tails a log and replaces it line-by-line according to whatever you want to replace. Useful if the file writing to the log can't be modified, so you need to modify its output instead.
Sample Output
echo "line1
find
line2" >> logfile

Output:
line1
replace
line2

0
By: tyzbit
2020-08-07 12:26:39

What Others Think

Go to google to validate.
sachelharrison · 5 weeks and 6 days ago
Sydney Cabling offers digital tv antenna installation services all around Sydney. Better than doing a DIY, it's better to call for a professional installer to handle your antenna needs.
sachelharrison · 5 weeks and 6 days ago
Software engineer job is one of the best jobs to have this 2020. It's very in demand and you'll be astonished by how high software engineer salary is now. The job is highly rewarding and so sought after, be prepared for a competition.
sachelharrison · 5 weeks and 6 days ago
C and C++ are the totally love for the students who just begin the programming and start in this career with the professionals if anyone wants to work for web applications, web development company then work in a team like include the experts or related the services they will definitely hit toward the C or C++.
MaryRudolph · 5 weeks and 6 days ago
google
juliahaycraft · 5 weeks and 4 days ago
Really appreciate you sharing this blog post.Much thanks again. Fantastic. GBWhatsApp For Android
GBWhatsappApk · 5 weeks and 3 days ago
Thanks for your sharing [url=https://trexgame.co]t rex game[/url]
Lisa1812 · 5 weeks and 2 days ago
What's the difference between this and the following? tail -F logfile | sed 's/unix/linux/g' I tried both, and they seemed to behave identically.
jcholewa · 4 weeks ago
It is important to understand that there is no truly hypoallergenic cat, probably because there is no typically allergic person. Different people are allergic to different things, so some cats that trigger your allergies may not affect other people. https://purrpetrators.com/which-cats-are-hypoallergenic/
goyate · 3 weeks and 3 days ago
It is important to understand that there is no truly hypoallergenic cat, probably because there is no typically allergic person. Different people are allergic to different things, so some cats that trigger your allergies may not affect other people. https://purrpetrators.com/which-cats-are-hypoallergenic/
goyate · 3 weeks and 3 days ago
Du home package
catherineharris · 2 weeks and 5 days ago
Unfortunately, the use of CBD hemp oil as a treatment for various diseases is not allowed. CBD products are marketed as dietary supplements that help support and maintain body and brain health. QCD Hemp Oil is here for everyone, whether you are sick or healthy https://validcbdoil.com
WillisLagergren · 2 weeks and 5 days ago
Unfortunately, the use of CBD hemp oil as a treatment for various diseases is not allowed. CBD products are marketed as dietary supplements that help support and maintain body and brain health. QCD Hemp Oil is here for everyone, whether you are sick or healthy validcbdoil
WillisLagergren · 2 weeks and 5 days ago
nice topic learn more
saeed20 · 2 weeks and 5 days ago
. A regular expression is a compact way of describing complex patterns in text. Hardwood Floor Refinishing Milwaukee it will divide a line up according to the position of the ':' which is useful for files like
emilygoutagny · 2 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: