sed: Easily replace strings across files | #7 Practical Bash
Vložit
- čas přidán 20. 08. 2019
- How do you replace easily replace strings across your entire code base? Now please don't say "My IDE has a feature for that". Of course, there's a simple way to do it with the terminal with the built-in command "sed". Another omni-present command that can be so helpful in everyday coding work, scripting, refactoring and all other string replacement needs.
- Věda a technologie
My first attempt at replacing strings with sed and my current example has / in the replacement, massive help!
Great work on this series, really helpful. One tip I learned: to save the hassle of deleting all those .bak files on macos, you can say sed -i '' (two single quotes) and no new files will be created. Anyway, I look forward to watching the rest of these!
These videos has been a really great help to me. Thank you so much 🙌
How do you get the bottom theme bar for you tmux session?
A video on your dev environment (dotfiles, vim and terminal setup, etc) would be very cool. Great video!
On the list. The past few weeks have been unusually busy (with non-Kubucation work), so I haven’t had the time to create new videos yet - but this is one I‘m definitely planning on making.
you should do awk, love the way you teach.
May I ask you is there a chance that you will make similar video but instead of sed you try explain awk ?
Hi Sir, how to specify the row number and column number in sed command?
Pls help me!!
Thank you very much for these great tutorials on bash basic - I find them very useful! Sometimes you switch the command your are currently writing to vim and then back again - how do you do that? And can it be done with other code editors?
Yes, this should work with whichever editor you have set in your EDITOR env var. I press Ctrl-x-Ctrl-e (as in hold Ctrl and press x, release x, keep holding control, then press e). I think this is actually an emacs feature, so your shall has to be configured to emacs bindings (most are by default).
And thank you for liking the tutorials :-)
@@kubucation It WORKS! thank you very much!
Hi I want to replace something that has a pattern so I have files with eg. .....1_....: and I want to remove what is after the '_' so my output would be ....1:
How can i change $var=123456 to $output=12:34:56:00 with sed? I hope it can be done very easily with a one-liner? if not sorry for asking, then maybe you can give me some pointers to solve this problem. thx
How did you switch to cli output on 1:32?
i think he's using set -o vi thing in .bashrc
FIrst week in new job surrounded by shmython gurus, volunteer for the 'long day' task to fix the spelling error in 12,000 files, home before morning tea break. 😀
Why so sed?
Awkey
sed life ! but it's ok 😁 🤣😂🤣
Omg