题目内容

输入为用,分隔的多个字段,其中有些字段可以为空,请使用sed将第3个字段的内容替换为39。$ echo 'desk,,,window,chair' | sed -E '_____________'desk,,39,window,chair

查看答案
更多问题

将除了前两次匹配的所有a替换为7。$ echo 'hear have Isaac eagar' | sed -e '_____________'hear have Is77c e7g7r

将文件 tao.txt 中所有行替换为该行的字符数(命令wc -L可以获得行的长度)$ cat tao.txtTao of computer scienceIf the Tao is great,then the operating system is good.If the operating system is great,then the compiler is great.If the compiler is great,then the application is great.The user is pleased,and there is harmony in the world.$ sed -ne '_____________________' tao.txt232034332725302034

对于文件begin-end.txt,假设该文件总是包含行号为4的倍数的行,使用sed命令每次读入4行到模式空间,然后从第一次出现的行首的begin开始一直删除到end,并且不区分begin和end的大小写。$ sed -ne '____________________' begin-end.txtgood beginhi therebye

对于给定的字符串,将倒数第3个he替换成M,并且仅打印被替换操作改变了的行:echo 'he and she here head and ache' | sed -nr '_______________________'he and she Xre head and ache

答案查题题库