如果第一个值小于10000,则排除数据结果 特殊情况更严重的是:

我以这种方式从“惩罚盒” ip地址列表中提取数据

grep "" pbdb.black.db | awk '{print $4" "$5}'  | sort -nr

它返回这样的列表

38692 193.111.77.250
36212 193.111.77.231
34192 193.111.77.223
27882 193.111.77.207
21202 193.111.77.122
16000 193.111.78.245
15202 45.91.148.61
15202 45.91.148.61
14340 193.111.78.235
11370 45.91.148.46
10350 193.111.77.85
8487 113.111.48.60
8487 113.111.48.60
7903 193.32.160.152
7458 193.32.160.151
7270 193.32.160.150
6800 193.32.160.149
6202 113.111.55.21   
...
... other data
...
6 118.161.142.167
6 118.161.142.167
2 94.103.64.12
2 94.103.64.12
2 78.188.155.79
2 78.188.155.79
2 196.252.52.24
2 196.252.52.24
2 119.153.102.248
2 119.153.102.248

要从第一个值(在IP地址之前)小于10000的结果数据中排除该结果,我该怎么做?

38692 193.111.77.250
36212 193.111.77.231
34192 193.111.77.223
27882 193.111.77.207
21202 193.111.77.122
16000 193.111.78.245
15202 45.91.148.61
15202 45.91.148.61
14340 193.111.78.235
11370 45.91.148.46
10350 193.111.77.85
qq568957159 回答:如果第一个值小于10000,则排除数据结果 特殊情况更严重的是:

看到您的输出似乎需要大于10000的值。

 awk '$1>9999' Input_file

OR

your_command |  awk '$1>9999'
,

特殊情况

Traceback (most recent call last): File "D:\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py",line 544,in urlopen body=body,headers=headers) File "D:\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py",line 341,in _make_request self._validate_conn(conn) File "D:\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py",line 761,in _validate_conn conn.connect() File "D:\Python37\lib\site-packages\requests\packages\urllib3\connection.py",line 238,in connect ssl_version=resolved_ssl_version) File "D:\Python37\lib\site-packages\requests\packages\urllib3\util\ssl_.py",line 279,in ssl_wrap_socket return context.wrap_socket(sock,server_hostname=server_hostname) File "D:\Python37\lib\ssl.py",line 412,in wrap_socket session=session File "D:\Python37\lib\ssl.py",line 850,in _create self.do_handshake() File "D:\Python37\lib\ssl.py",line 1108,in do_handshake self._sslobj.do_handshake() ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host During handling of the above exception,another exception occurred: Traceback (most recent call last): File "D:\Python37\lib\site-packages\requests\adapters.py",line 370,in send timeout=timeout File "D:\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py",line 597,in urlopen _stacktrace=sys.exc_info()[2]) File "D:\Python37\lib\site-packages\requests\packages\urllib3\util\retry.py",line 245,in increment raise six.reraise(type(error),error,_stacktrace) File "D:\Python37\lib\site-packages\requests\packages\urllib3\packages\six.py",line 309,in reraise raise value.with_traceback(tb) File "D:\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py",in do_handshake self._sslobj.do_handshake() requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.',ConnectionResetError(10054,'An existing connection was forcibly closed by the remote host',None,10054,None)) During handling of the above exception,another exception occurred: Traceback (most recent call last): File "D:\works\Python\Sample\dummy.py",line 8,in <module> post('https://api.telegram.org/bot' + token + '/sendMessage?chat_id=' + channelName + '&text=' + qt(message) + '&parse_mode=markdown') File "D:\Python37\lib\site-packages\requests\api.py",line 109,in post return request('post',url,data=data,json=json,**kwargs) File "D:\Python37\lib\site-packages\requests\api.py",line 50,in request response = session.request(method=method,url=url,**kwargs) File "D:\Python37\lib\site-packages\requests\sessions.py",line 465,in request resp = self.send(prep,**send_kwargs) File "D:\Python37\lib\site-packages\requests\sessions.py",line 573,in send r = adapter.send(request,**kwargs) File "D:\Python37\lib\site-packages\requests\adapters.py",line 415,in send raise ConnectionError(err,request=request) requests.exceptions.ConnectionError: ('Connection aborted.',None)) 之后,您可以通过以下方式使用sort -rn

sed

这将从找到的少于5位数字的第一行到输入的末尾删除行。

更严重的是:

阅读您的帖子。我会建议:

 ... | sort -rn | sed '/^[0-9]\{1,4\} /,$d'

或者甚至在grep "RE" filename | awk '{if ($4 >= 10000) print $4,$5}' | sort -rn 而不是awk中执行/ RE /:

grep
本文链接:https://www.f2er.com/3146774.html

大家都在问