wonder Expert Licensed User Longtime User Nov 6, 2016 #1 If you're using Linux, Git Bash on Windows, or any other viable option that allows you to run bash scripts, you may use this to cleanup your source files: *** Remember to backup your files first!!! *** Code: Copy #!/bin/bash #Project Cleanup Script # - Replaces all tabs with 4 spaces # - Removes all trailing white space sed -i 's/\t/ /g' *.b4a sed -i 's/\s*$//g' *.b4a sed -i 's/\t/ /g' *.bas sed -i 's/\s*$//g' *.bas *** Remember to backup your files first!!! *** Last edited: Nov 6, 2016
If you're using Linux, Git Bash on Windows, or any other viable option that allows you to run bash scripts, you may use this to cleanup your source files: *** Remember to backup your files first!!! *** Code: Copy #!/bin/bash #Project Cleanup Script # - Replaces all tabs with 4 spaces # - Removes all trailing white space sed -i 's/\t/ /g' *.b4a sed -i 's/\s*$//g' *.b4a sed -i 's/\t/ /g' *.bas sed -i 's/\s*$//g' *.bas *** Remember to backup your files first!!! ***
thedesolatesoul Expert Licensed User Longtime User Nov 7, 2016 #2 Nice. There is also a sed version for windows, so we can do this in .bat, and remove the dependency from bash. Also, I would prefer to not do inline replacement, as you said, just do the backup in this same script. i.e. sed "regex" infile > outfile && mv infile infile.old && mv outfile infile ...and if you really want to make sure it works, also run a b4a commandline compile, and check it all compiles, and then autocommit!
Nice. There is also a sed version for windows, so we can do this in .bat, and remove the dependency from bash. Also, I would prefer to not do inline replacement, as you said, just do the backup in this same script. i.e. sed "regex" infile > outfile && mv infile infile.old && mv outfile infile ...and if you really want to make sure it works, also run a b4a commandline compile, and check it all compiles, and then autocommit!
wonder Expert Licensed User Longtime User Nov 7, 2016 #3 thedesolatesoul said: There is also a sed version for windows Click to expand... Cool, didn't know that! Thanks!
thedesolatesoul said: There is also a sed version for windows Click to expand... Cool, didn't know that! Thanks!
thedesolatesoul Expert Licensed User Longtime User Nov 7, 2016 #4 http://gnuwin32.sourceforge.net/packages/sed.htm Though hasnt been updated in a while.