Skip to content

Instantly share code, notes, and snippets.

@mdukat
Created October 24, 2019 17:51
Show Gist options
  • Save mdukat/7bb750726a9a85acf27ec75fab1d0ac6 to your computer and use it in GitHub Desktop.
Save mdukat/7bb750726a9a85acf27ec75fab1d0ac6 to your computer and use it in GitHub Desktop.
Quick sed example of \1, \2, etc
#!/bin/bash
# \(.\) matches one character, which will be available by \1
# \(.*\) matches one or more characters, which will be available by \1
# & places whole input, without changes
ls Lolishit* | sed 's/ /\\ /g' | sed 's/\(.*\)-.*$/mv & \1.flac/' | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment