QuestionQ53

VerifiedGNU and Unix Commands

Given this input stream:

txt1.txt  
atxt.txt  
txtB.txt  

Which of the following regular expressions transforms this input stream into the following output stream?

txt1.bak.txt  
atxt.bak.txt  
txtB.bak.txt  
Explanation

The end-of-line anchor ($) restricts the match to the final txt in each filename. Replacing that suffix with bak.txt inserts .bak immediately before the existing .txt extension.

Community Discussion

No comments yet. Be the first to start the discussion!