this may seem basic but Is there a way to create a batch to remove char from a string from a txt file. ?
If I already have this inside the .txt file
2005060.png
2005070.png
2005080.png
2005090.png
so is there a way to create a batch file that will remove the .png at the end to show only this in a new .txt file
2005060
2005070
2005080
2005090
Thanks for any help on this! 🙂
You can do it as per the following command script:
This outputs:
The magic line, of course, is:
which removes the last four characters.
If you have a file
testprog.inwith lines it it, like:you can use a slight modification:
which outputs:
Just keep in mind that it won’t output empty lines (though it will do lines with spaces on them).
That may not be a problem depending on what’s allowed in your input file. If it is a problem, my advice is to get your hands on either CygWin or GnuWin32 (or Powershell if you have it on your platform) and use some real scripting languages.