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.
ag [options] pattern [path ...]. That implies only one pattern. Have you triedag '\/call_me_maybe' | ag -v '\?paramor evenag '\/call_me_maybe' | grep -v '\?param?