Hi,
Like TKH, I'm not entirely clear about your wishes.
Assuming this is your input:
Code:
# ls -l
total 0
-rw-r----- 1 druuna internet 0 Mar 9 08:54 betco033tco.out
-rw-r----- 1 druuna internet 0 Mar 9 08:54 detco011tco.out
-rw-r----- 1 druuna internet 0 Mar 9 08:54 nltco022tco.out
Running this code:
Code:
for THISFILE in *tco.out; do mv $THISFILE $(echo ${THISFILE/tco/acw} | sed 's/tco//'); done
You will end up with this:
Code:
$ ls -l
total 0
-rw-r----- 1 druuna internet 0 Mar 9 08:54 beacw033.out
-rw-r----- 1 druuna internet 0 Mar 9 08:54 deacw011.out
-rw-r----- 1 druuna internet 0 Mar 9 08:54 nlacw022.out
betco033tco.out changes to beacw033.out (first tco is changed to acw, second tco is removed).
Hope this helps.