Bash: for loop; loop through files; remove path and suffix from file names
Credit for the bash for loop goes here: http://www.cyberciti.biz/faq/bash-for-loop/
Credit for the suffix and prefix modifications goes here: http://stackoverflow.com/questions/125281/how-do-i-remove-the-file-suffix-and-path-portion-from-a-path-string-in-bash
Loop through a series of numbers:
Credit for the suffix and prefix modifications goes here: http://stackoverflow.com/questions/125281/how-do-i-remove-the-file-suffix-and-path-portion-from-a-path-string-in-bash
Loop through a series of numbers:
#!/bin/bash for int in 1 2 3 4 do echo $int doneLoop through a series of files and modify the file name; see the Stack Overflow link above for a few more options:
#!/bin/bash files=pathToFiles/*.tsv for file in $files do echo $file SUFFIX=${file%.*} echo $SUFFIX NEWNAME=${SUFFIX##*/}.txt echo $NEWNAME done
Comments
Post a Comment