Sample Header Ad - 728x90

search with and without a pattern with ag

0 votes
1 answer
1234 views
With two files with echo 'example.com/call_me?param' > file1.txt echo 'example.com/call_me_maybe?param' >> file1.txt echo 'example.com/call_me?' >> file1.txt echo 'example.com/call_me?param' > file2.txt echo 'example.com/call_me_maybe?' >> file2.txt $ ag -v '\?param' file2.txt 2:example.com/call_me_maybe? file1.txt 3:example.com/call_me? $ ag '\/call_me_maybe' -v '\?param' ERR: Error stat()ing: \?param ERR: Error opening directory \?param: No such file or directory $ ag '\/call_me_maybe' -v '\?param' file1.txt ERR: Error stat()ing: \?param ERR: Error opening directory \?param: No such file or directory file1.txt 1:example.com/call_me?param 3:example.com/call_me? I would like to search for one term and exclude the other pattern. Is it possible in one command? I'm using ag because it digging into log.gz files. So I can use zgrep or ag -z.
Asked by PockPock (103 rep)
Jan 17, 2018, 02:06 PM
Last activity: Jan 17, 2018, 02:31 PM