Skip to content

Instantly share code, notes, and snippets.

@ekiara
Last active November 3, 2021 06:29
Show Gist options
  • Save ekiara/4614815 to your computer and use it in GitHub Desktop.
Save ekiara/4614815 to your computer and use it in GitHub Desktop.
snippets-bash.rst

Bash Snippets

Get the first and last line from stdout input

https://unix.stackexchange.com/questions/139089/how-to-read-first-and-last-line-from-cat-output

Rename WINDOWS-ILLEGAL filenames in Linux

find . -name "*[<>:\\|?*]*" -exec bash -c 'x="{}"; y="$(sed "s/[<>:\\|?*]\+/-/g" <<< "$x")" && mv "$x" "$y" ' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment