Monday, April 29, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 2321  / 3 Years ago, thu, september 16, 2021, 3:48:44

I have a grader for COCI (a competitive programming contest) that reads input files (txt[number].in), compiles and runs a code (txt.cpp) and matches the result with an output file (txt[number].out).
The problem is, COCI problem's input files have format (txt.in.1), (txt.in.2), (txt.in.3) etc and similar names for output files.



I need to change the extensions of the input files from txt.in.[number] to txt[number].in. (Need to do the same for the output files as well)



Can anyone help me with this?



I'm currently using 13.04 Ubuntu.


More From » command-line

 Answers
4

Using the terminal, I think this is the easiest way:



mmv -v "*.in.*" "#1#2.in"


Here is a test:



$ ls
txt.in.1 txt.in.2 txt.in.3
$ mmv -v "*.in.*" "#1#2.in"
txt.in.1 -> txt1.in : done
txt.in.2 -> txt2.in : done
txt.in.3 -> txt3.in : done
$ ls
txt1.in txt2.in txt3.in


By default, mmv is not installed in Ubuntu, but you can install it from terminal using the following command:



sudo apt-get install mmv


See man mmv for more info.


[#29172] Saturday, September 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
horicgly

Total Points: 36
Total Questions: 126
Total Answers: 104

Location: Iceland
Member since Thu, Dec 1, 2022
1 Year ago
;