小编Dra*_*onX的帖子

如何使用grep排除多个模式

我想排除两者"*log*"./tags从grep的.

我做的是:

grep -rI "PatternToSearch" ./path --exclude="*log*" 
Run Code Online (Sandbox Code Playgroud)

或这个:

grep -rI "PatternToSearch" ./path --exclude="tags"
Run Code Online (Sandbox Code Playgroud)

是否可以在一个grep中合并两个排除模式?

linux shell grep command

8
推荐指数
1
解决办法
1万
查看次数

gethostbyname() 或 getnameinfo() 如何在后台工作?

如何gethostbyname()getnameinfo()在后台工作?

#include <stdlib.h>
#include <stdio.h>
#include <netdb.h>

/* paddr: print the IP address in a standard decimal dotted format */
void
paddr(unsigned char *a)
{
        printf("%d.%d.%d.%d\n", a[0], a[1], a[2], a[3]);
}

main(int argc, char **argv) {
        struct hostent *hp;
        char *host = "google.com";
        int i;

        hp = gethostbyname(host);
        if (!hp) {
                fprintf(stderr, "could not obtain address of %s\n", host);
                return 0;
        }
        for (i=0; hp->h_addr_list[i] != 0; i++)
                paddr((unsigned char*) hp->h_addr_list[i]);
        exit(0);
}
Run Code Online (Sandbox Code Playgroud)

google.com 的输出:

74.125.236.198 …
Run Code Online (Sandbox Code Playgroud)

c sockets linux

2
推荐指数
1
解决办法
5260
查看次数

未绑定服务器不响应由未绑定客户端 API 发出的 dns 查询

我正在尝试测试 dnsmasq 和未绑定服务器。当我从机器“Y”执行 getaddrinfo() 请求时,我从 dnsmasq 服务器机器“X”获得 dns 查询响应。但是,当我通过关闭 dnsmasq 并在机器“X”上启动未绑定服务器从“Y”未绑定客户端的 API发送 dns 查询时,我看不到任何 dns 响应/解析。

我已经从源代码安装了未绑定的服务器,并解决了它对“X”上的 RHEL5 的依赖关系。

我在机器“X”上启动未绑定的服务器:

未绑定-c /usr/local/etc/unbound/unbound.conf

并且可以正常启动,没有任何错误。

unbound.conf 的配置是:

server:
        verbosity: 1
## Specify the interface address to listen on:
        interface: xxx.xxx.xxx.xxx
## To listen on all interfaces use:
#       interface: 0.0.0.0
        do-ip4: yes
        do-ip6: yes
        do-udp: yes
        do-tcp: yes
        do-daemonize: yes
        access-control: 0.0.0.0/0 allow
## Other access control examples
#access-control: 192.168.1.0/24 action
## 'action' should be replaced by any one of: …
Run Code Online (Sandbox Code Playgroud)

linux dns unboundid-ldap-sdk

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

linux ×3

c ×1

command ×1

dns ×1

grep ×1

shell ×1

sockets ×1

unboundid-ldap-sdk ×1