some notes on the sample awk/sed/perl one-liner given:
# input line has to be explicitly printed
awk '{gsub(/Jack/,"Jill")} 1' file.txt
# -i will do inplace editing, unlike the awk command
# -i by itself won't work on non-GNU versions, needs backup extension
sed 's/Jack/Jill/g' file.txt
# use single quotes always, unless double is needed
# -p will behave like default sed
perl -pe 's/Jack/Jill/g' file.txt
personally, I prefer the terseness of these commands over verbose SQL like syntax (and also the fact that I don't know SQL like tools)
However, I would agree that initial learning curve is tough for sed/awk/perl. Once you get familiar with their idioms, they become the swiss army knife of cli text processing (along with grep). I have an entire repo dedicated to such tools[1]
That looks very nice, thank you for sharing/writing it!
Are you responsible for updating the Cargo package? It's the first time I've used Cargo and was wondering how often I should re-run it or check for updates?
You can run cargo install-update -a every now and then to check for updates. At some point in a few weeks I hope to have binaries distributed with every release, which means there will be better/faster ways to install sd than cargo.
looks interesting, bookmarked (will possibly add tutorial on this someday)
one question though, sed is not just search and replace, it is filter + search and replace (without going into arcane commands like n,N,x,h,etc) - filtering can be done based on regex, line number, combination of these two for blocks of line, etc.. Does sd support these?
tl;dr its only find & replace with smart defaults and easy, straightforward syntax because I hated wrangling with sed's quirks. For more features, you're better off with sed. But if you're like me and only really use sed for find/replace, you will have a good time with sd.
However, I would agree that initial learning curve is tough for sed/awk/perl. Once you get familiar with their idioms, they become the swiss army knife of cli text processing (along with grep). I have an entire repo dedicated to such tools[1]
[1] https://github.com/learnbyexample/Command-line-text-processi...