All Questions
59
questions
0
votes
1
answer
79
views
How to use grep string that has double quotes in it
So I'm running a simple alias called vpn which runs a command and has an output, which I put into a .txt file.
If interested to what exactly then here is the alias
alias vpn="docker exec -it ...
-1
votes
1
answer
42
views
I can't grep some inputrc string
bind -p |grep -E "\\e.\":" work
but
bind -p |grep -E "\\e\\C-.\":" don't work
I tried a lot of combination
-1
votes
3
answers
94
views
How to use a variable in a command inside of a bash file
I use this command directly on our redhat linux server 8.8 and it's working correctly and I get the result I want:
grep '01-FEB-2024' /u01/app/server1/listener_scan/trace/listener_scan.log | awk '{ if ...
3
votes
1
answer
7k
views
Grep pattern that has double quotes and variable substitution surrounded by single quotes
So, Let's say I have the following pattern:
Thisisatest="1"
in a file called file.
And I want to match the exact string above but for whatever reason, I choose to loop over some numbers ...
1
vote
1
answer
2k
views
grep: use square brackets to match specific characters
So I am experimenting with the power of grep using this resources
The problem I am currently encountering is that it doesn't seem to work as I intended. so I have an demo.txt file that contains foo....
3
votes
1
answer
2k
views
prevent single quotes in bash script
I have a bash script that's just a shortcut to the grep command. I call it like this:
stx -p /var/www -t 'my text'
This would run this command:
sudo grep -rinI /var/www -e 'my text'
I'm trying to ...
5
votes
2
answers
26k
views
How do I grep multiple patterns from a pipe
I want to find three patterns in a list. I tried typing
$ pip3 list | grep -ei foo -ei bar -ei baz
but the shell throws a broken pipe error and a large Traceback.
How do I grep for multiple ...
1
vote
1
answer
325
views
grep not working when I enclose the directory in double quotes
When I do something like this:
grep "hello" /home/paul/*
It works.
But when I do something like this:
grep "hello" "/home/paul/*"
grep display the error:
grep: /home/paul/*: No such file or ...
-2
votes
2
answers
3k
views
Grep not working with variables, even with quotes
name=$(echo "$FILENAME" | grep -E '*\.(eng|por|pt-BR)\.*')
Why this line doesn't work?
if I do
echo "Test (2013).1080p.por.mkv" | grep -E "*\.(eng|por)\.*"
It works, I tried with "" without " and ...
4
votes
4
answers
5k
views
How do I invoke jq inside awk?
Essentially I have a file.log as follow
blah blah
blah blah
Hello world | {"foo": "bar"}
blah blah
Hello earth | {"foo1": "bar1"}
Now my goal is to write some shell commands to have desire output ...
4
votes
3
answers
15k
views
How can search for both single quotes and double quotes in a grep search?
When I do a search bindkey in the zsh plugins directory for key conflicts I get responses from both the .zsh script files and .md files, and some of the zsh readme files use a double quote in the ...
4
votes
3
answers
13k
views
Escape [ in grep
I read strings from stdin and I want to display the users that match the strings. Problem is, if the user inputs the character '[', or a string containing it.
grep -F does not work because the line ...
5
votes
4
answers
10k
views
Backslash usage in different commands
I have been trying to get a better understanding of how backslash is used in certain commands. I understand its usage for escaping special characters (Such as echo 'that'\''s no moon'
), but the ...
1
vote
3
answers
945
views
Why doesn't grep return what I expect when I use single quotes
I have a file with the below contents:
sh-4.2$ cat file1
example of multiple
pattern
this is an
example of multipole
sorry multiple
pattern matching
using grep
so the example is the
file itself
-...
0
votes
4
answers
2k
views
grep syntax for searching strings with single-quotes?
So, I have a .js file as below and I am trying to search with the below grep pattern. I am not sure what mistake I did but it does not give any output even though the file has that pattern. What ...