Assuming you have a whole bunch of files that you need to change their extension from one to another, you can use the following commands after setting the values for the BEFORE and the AFTER variables to the values you need. BEFORE='.txt'; AFTER='.csv'; find . -type f -name "*$BEFORE" -exec…
The following function takes one argument - a text file.The text file should contain one word on each line.The function reads the text file (argument) line by line.Then it checks if the line has one word; if this is true, it splits the word in half.Finally, it prints the two…
In order to print the leading zeros to a variable you need to use the function printf as follows, where %03d states that the number should consist of minimum 3 digits and thus it will put the missing leading zeros: printf %03d $counter The following example renames a file that…