Replace second character instead of first
Let's say I have files like:
123_abc_as656512.txt
123_abd_as65612.txt
123_abe_as16562.5txt
123_abf_as1542.txt
123_abg_as131232.txt
123_abh_a123s12.txt
I want to replace them with
123_abc
123_abd
123_abe
123_abf
123_abg
123_abh
So essentially look for the second "_" and replace everything after that with nothing.
I was looking at something like this:
for FILE in <loop in the folder>
do
FILER=${FILE//_*} #Though this will get rid of everything after the 1st "_" character
done
any help??
|