ASA*_*SAD 3 command-line text-processing
我怎样才能使除第一列以外的所有内容小写?
喜欢:
1 ONE
2 TWO TWO
3 THREE THREE THREE
Run Code Online (Sandbox Code Playgroud)
所需输出:
1 one
2 two two
3 three three three
Run Code Online (Sandbox Code Playgroud)
您可以使用 GNUsed的小写\L扩展名:
sed -r 's/([^ \t]+\s)(.*)/\1\L\2/' file
Run Code Online (Sandbox Code Playgroud)
-r 使用EREs/old/new/替换old为new([^ \t]+\s) 保存一些不是空格或制表符的字符,后跟空格或制表符(.*) 保存任意数量的任意字符\1\L\2 打印第一个保存的部分不变,然后第二个保存的部分小写