我使用命令grep文件内容,并做一些事情.
但是,文件大小每秒都在不断增长.(将大于500MB)
由于性能问题,我想在最后N行而不是整个文件内容中grep文件内容.
if grep -q "SOMETHING" "/home/andy/log/1.log"; then
ps -ef | grep "127.0.0.1:50000" | awk '{print $2}' | xargs kill; cat /dev/null > /home/andy/log/1.log
fi
Run Code Online (Sandbox Code Playgroud)
如何修改脚本以在最后N行中grep文件内容?
谢谢!
如果ListView只显示5个项目,则所有数据为40个项目.如何获得当前选择的可见项目(1~5)中的哪个位置?我已经尝试 getSelectedItemPosition但它将返回所有数据中的位置.我想在每个项目上显示可见项目中的位置编号.
class MyAdapter extends BaseAdapter {
@Override
public int getCount(){
...
}
@Override
public Object getItem(int position){
...
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
// I want to get the position number in visible items here
}
}
Run Code Online (Sandbox Code Playgroud) 我不希望网站的apache返回任何HTTP代码404,
原因是认证委员会将扫描所有网站,
许多javascript链接和一些事件将导致404代码,
事实上,这些链接是有效但但是检查员会误判错误.
所以,我想阻止apache返回HTTP代码404,
如何配置apache 返回HTTP代码200而不是404并显示我的定义错误页面?