sed and Mac OS X differences with to upper, to lower and whole capture control sequences

前端 未结 2 479
独厮守ぢ
独厮守ぢ 2020-12-31 13:20

I am trying to take the last two letters out of a filename which are uppercase and append them to the filename in lowercase. I expeceted the command:



        
相关标签:
2条回答
  • 2020-12-31 13:39

    awk alternative:

    ls | awk '{print $0 tolower(substr($0,length($0)-1,2))}'
    
    0 讨论(0)
  • 2020-12-31 13:41

    OSX (BSD) sed doesn't support functions \L, \E etc. Install gnu sed on Mac using this option:

    brew install gnu-sed
    
    0 讨论(0)
提交回复
热议问题