From what we can discern of this question, you’re attempting to create a programmatic rule to rename files ending in extensions
status-captured (assuming one typo) into files ending in extensions
status-expected, respectively. Obviously, if each of these definitions is inclusive of exactly one file, a rote
mv may be more appropriate.
To perform the translation you desire with
sed, simply invoke the following in
/bin/bash with the desired target as your current working directory:
EXTENSION=stdout-captured REPLACEMENT=stdout-expected for arg in $(ls *.$EXTENSION); \ do mv $arg $(echo $arg | sed s/\\.$EXTENSION/.$REPLACEMENT/); \ done
$REPLACEMENT are defined for each of the cases that you wish to detect and replace for. This assumes no files contain
.$EXTENSION anywhere in the remainder of the filename.
awk is unnecessary for this solution.
For invoking this recursively across multiple directories, consider replacing
find and updating the rule accordingly. Note that
find has its own facilities to perform operations on found resources, as well.