-bash-4.1$ cat text find the Match statement Consult the Get statement using the Read statement to retrieve data -bash-4.1$ cat sedsrc1 /the .* statement/{ h s/.*the (.*) statement.*/\1/ y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ G s/(.*)\n(.*the ).*( statement.*)/\2\1\3/ } -bash-4.1$ sed -r -f sedsrc1 text find the MATCH statement Consult the GET statement using the READ statement to retrieve data -bash-4.1$ cat sedsrc2 /the .* statement/{ s/(.*the) (.*) (statement.*)/\1 \U\2\E \3/ } -bash-4.1$ sed -r -f sedsrc2 text find the MATCH statement Consult the GET statement using the READ statement to retrieve data
方法一使用y命令、Holding Space,方法二使用GNU的sed擴展\U和\Ehtml