首页 > 试题广场 >

去掉所有包含this的句子

[编程题]去掉所有包含this的句子
  • 热度指数:14419 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
编写一个shell脚本以实现如下功能:去掉输入中含有this的语句,把不含this的语句输出

示例:
假设输入如下:
that is your bag
is this your bag?
to the degree or extent indicated.
there was a court case resulting from this incident
welcome to nowcoder

你的脚本获取以上输入应当输出:
that is your bag
to the degree or extent indicated.
welcome to nowcoder

说明:
你可以不用在意输出的格式,包括空格和换行
示例1

输入

that is your bag
is this your bag?
to the degree or extent indicated.
there was a court case resulting from this incident
welcome to nowcoder

输出

that is your bag
to the degree or extent indicated.
welcome to nowcoder
grep -v 'this'
发表于 2021-04-21 10:49:31 回复(0)
sed '/this/d'
发表于 2020-12-14 15:44:33 回复(0)
awk '!/this/' nowcoder.txt
发表于 2021-06-21 21:00:57 回复(0)
sed -n '/this/!p'  nowcoder.txt
发表于 2021-05-25 13:32:54 回复(0)
awk '$0!~/this/ {print $0}'
发表于 2020-12-01 22:13:30 回复(0)
cat $1 |grep -v "this"
发表于 2020-11-12 21:34:17 回复(1)
从哪获得输入?
发表于 2024-03-09 20:21:40 回复(0)
grep -v this
编辑于 2024-02-16 19:37:01 回复(0)
grep -v 'this'
sed '/this/d'
awk '!/this/ {print $0}'

awk '!/this/ {print $0}'

发表于 2023-05-28 08:57:13 回复(0)
sed 's/^.*this.*$//g'
发表于 2023-03-14 16:06:47 回复(0)
grep -v "this" nowcoder.txt
awk '!/this/{print $0}' nowcoder.txt
发表于 2022-08-27 18:05:36 回复(0)
awk '!/this/{print}'
发表于 2022-08-23 20:37:53 回复(0)
cat nowcoder.txt | grep -v this
发表于 2022-07-13 19:04:18 回复(0)
awk '!/this/ {print $0}'
发表于 2022-07-08 15:31:33 回复(0)
sed '/this/d'

发表于 2022-06-25 15:59:01 回复(0)
awk '!/this/{print}' nowcoder.txt
发表于 2022-06-21 11:47:02 回复(0)
awk '{if(index($0,"this")==0) print $0}' nowcoder.txt
发表于 2022-06-13 22:05:57 回复(0)
awk '{len=split($0,arr," ");}{for(i=1;i<=len;i++){if(arr[i] == "this"){next}}{print $0}}' nowcoder.txt
发表于 2022-06-02 11:49:34 回复(0)
#!/usr/bin/env bash
awk '$0 !~ /this/{print $0}' nowcoder.txt
发表于 2022-03-25 11:20:14 回复(0)
grep -v 'this'
发表于 2022-03-01 11:31:18 回复(0)