bash删除行包含三次以上
我有这个文件,其中包含数百万行,我应该用bash删除所有包含三倍以上单词“ .. Nessuna risposta”的行。
例如:在此输出中,我应该删除行“ 1003”,“ 1084”和“ 1096”(然后删除空白行)但不是最后一行“ 1119” ,因为此行包含Word。 Nessuna Risposta“只有两次。
1003;"N.Nuovo";"4";"327";"";01102019;"1.F";"49";"4.LAUREA";"1.ITALIANA";"2.Allo sportello";"1.Nessuna Risposta";"2";"6";"5.Nessuna Risposta";"2";"4";"2.Nessuna Risposta";"2";"1";"3";"3"
1084;"N.Nuovo";"4";"327";"";02102019;"1.F";"66";"2.SCUOLA OBBLIGO";"1.ITALIANA";"2.Allo sportello";"7.Nessuna Risposta";"7";"6";"7.Nessuna Risposta";"5";"7";"7";"7.Nessuna Risposta";"7";"7";"7"
1095;"N.Nuovo";"4";"327";"";"327001951";"Poliambulatori";02102019;"1.F";"59";"2.SCUOLA OBBLIGO";"1.ITALIANA";"1.Telefonicamente";"5";"5";"5";"5";"7";"6";"6";"7";"6";"6";"6"
1096;"N.Nuovo";"4";"327";"";"327001951";"Poliambulatori";01102019;"2.M";"48";"3.SCUOLA SUP";"1.ITALIANA";"2.Allo sportello";"6";"5.Nessuna Risposta";"5";"6";"6.Nessuna Risposta";"7";"7";"7.Nessuna Risposta";"7";"7";"7"
1119;"N.Nuovo";"4";"327";"";"327001951";"Laboratorio";03102019;"2.M";"30";"3.SCUOLA SUP";"1.ITALIANA";"2.Allo sportello";"6";"6.Nessuna Risposta";"6";"4.Nessuna Risposta";"6";"6";"6";"6";"6";"6";"6"
我已经找到并尝试了此脚本,但是计数 *{3,}不起作用,因为此删除所有行都包含单词“ .. Nessenaa risposta”。你能帮我吗?
grep -v -e“。*nessuna risposta。*\ {3,\}” $ file_name
I have this file with some with millions of lines, I should delete with bash all lines that contain more than three times the word "..Nessuna Risposta" for row.
For example: in this output I should delete rows "1003", "1084" and "1096" (and then remove blank line) but not last row "1119" because this line contains word "..Nessuna Risposta" only two times.
1003;"N.Nuovo";"4";"327";"";01102019;"1.F";"49";"4.LAUREA";"1.ITALIANA";"2.Allo sportello";"1.Nessuna Risposta";"2";"6";"5.Nessuna Risposta";"2";"4";"2.Nessuna Risposta";"2";"1";"3";"3"
1084;"N.Nuovo";"4";"327";"";02102019;"1.F";"66";"2.SCUOLA OBBLIGO";"1.ITALIANA";"2.Allo sportello";"7.Nessuna Risposta";"7";"6";"7.Nessuna Risposta";"5";"7";"7";"7.Nessuna Risposta";"7";"7";"7"
1095;"N.Nuovo";"4";"327";"";"327001951";"Poliambulatori";02102019;"1.F";"59";"2.SCUOLA OBBLIGO";"1.ITALIANA";"1.Telefonicamente";"5";"5";"5";"5";"7";"6";"6";"7";"6";"6";"6"
1096;"N.Nuovo";"4";"327";"";"327001951";"Poliambulatori";01102019;"2.M";"48";"3.SCUOLA SUP";"1.ITALIANA";"2.Allo sportello";"6";"5.Nessuna Risposta";"5";"6";"6.Nessuna Risposta";"7";"7";"7.Nessuna Risposta";"7";"7";"7"
1119;"N.Nuovo";"4";"327";"";"327001951";"Laboratorio";03102019;"2.M";"30";"3.SCUOLA SUP";"1.ITALIANA";"2.Allo sportello";"6";"6.Nessuna Risposta";"6";"4.Nessuna Risposta";"6";"6";"6";"6";"6";"6";"6"
I have find and tried this script, but the count *{3,} not work, because this delete all lines contains word "..Nessuna Risposta". Can you help me, please?
grep -v -e ".*Nessuna Risposta.*\{3,\}" $FILE_NAME
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
GREP
Using
grep