I'm using this quickly put-together shell script called replace #!/usr/bin/env bash # Function to escape special characters for sed escape_sed_string() { printf '%s\n' "$1" | gsed -e 's/[]\/$*.^[]/\\&/g' } help() { gum style --foreground cyan --italic "\ Usage (everything optional, you will be prompted):\n\ $0\n\ --ext .js --ext .ts\n\ --from \"source string\"\n\ --to \"replacement string\"\n\ --dir somePath" } # Par…
Show HN: Scooter – Interactive find and replace in the terminal
61–70 of 81 posts
Re: Show HN: Scooter – Interactive find and replace in the terminal
#62Couldn't find it in nixpkgs.
In the meantime you can also add packages that aren't yet in nixpkgs using pkgs.callPackage.
Re: Show HN: Scooter – Interactive find and replace in the terminal
#63We're losing the art of bash ``` find -type f -iname '*.go' | xargs -r -n1 sed -i 's,foo,foobar,g' ```
Re: Show HN: Scooter – Interactive find and replace in the terminal
#64We're losing the art of bash ``` find -type f -iname '*.go' | xargs -r -n1 sed -i 's,foo,foobar,g' ```
Re: Show HN: Scooter – Interactive find and replace in the terminal
#65We're losing the art of bash ``` find -type f -iname '*.go' | xargs -r -n1 sed -i 's,foo,foobar,g' ```
Why use `xargs` instead of `-exec`? And if you do need `xargs` (for example, for parallel processing with `-P`), it is recommended to use `-print0` with `find` and `-0` with `xargs` to avoid issues due to filenames.
(and agree re -print0/-0, it's absolutely essential)
Re: Show HN: Scooter – Interactive find and replace in the terminal
#66We're losing the art of bash ``` find -type f -iname '*.go' | xargs -r -n1 sed -i 's,foo,foobar,g' ```
noone can remember these abbreviations
Re: Show HN: Scooter – Interactive find and replace in the terminal
#67We're losing the art of bash ``` find -type f -iname '*.go' | xargs -r -n1 sed -i 's,foo,foobar,g' ```
The problem is... if you use these on rare occasions it gets frustrating, because you have to read the manual or google everything or ask the llm again and again. noone can remember these abbreviations
Re: Show HN: Scooter – Interactive find and replace in the terminal
#68I'm using this quickly put-together shell script called replace #!/usr/bin/env bash # Function to escape special characters for sed escape_sed_string() { printf '%s\n' "$1" | gsed -e 's/[]\/$*.^[]/\\&/g' } help() { gum style --foreground cyan --italic "\ Usage (everything optional, you will be prompted):\n\ $0\n\ --ext .js --ext .ts\n\ --from \"source string\"\n\ --to \"replacement string\"\n\ --dir somePath" } # Par…
What is gum?
Re: Show HN: Scooter – Interactive find and replace in the terminal
#69I’ve been using serpl lately, https://github.com/yassinebridi/serpl
Re: Show HN: Scooter – Interactive find and replace in the terminal
#70Earlier quoted context omitted.
Why use `xargs` instead of `-exec`? And if you do need `xargs` (for example, for parallel processing with `-P`), it is recommended to use `-print0` with `find` and `-0` with `xargs` to avoid issues due to filenames.
xargs passes many inputs to one script invocation, so even with a single thread there is often a dramatic speedup. (and agree re -print0/-0, it's absolutely essential)
In any case, OP was using `-n1` which means one file per invocation.