Last active
April 1, 2021 05:57
-
-
Save samson-sham/516dc40eb92beb4a8d990ce79320adcd to your computer and use it in GitHub Desktop.
bash notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Renaming all files | |
ls -v sprites*.jpg | cat -n | while read n f; do mv -n "$f" "pc-$(($n-1)).jpg"; done | |
# ls -v : Natural sort | |
# cat -n : Appending line number before each line (Starts from 1) | |
# mv -n : Do not overwrite | |
# $(($n - 1)) : String to Int then arithmetics | |
# Appending file extension to all files | |
ls | xargs -I % mv % "%.mp4" | |
# Concatenates files with expression | |
ls prefix*.ts | xargs cat > concat.ts | |
# Check which files are not found in the series | |
# spaces between [[ ]] are important | |
for file in {1..500}.m4s; do if [[ ! -f "$file" ]]; then echo "$file not found"; fi; done | |
# Concatenates files with for-loop precised range | |
for file in v1_1-{1..198}.m4s; do echo $file; done | xargs cat > 1-198.m4s | |
# Single line command to concat both header and MDAT | |
cat v1_1-init.mp4 <(for file in v1_1-{61..198}.m4s; do echo $file; done | xargs cat) > segment.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment