All Questions
23
questions
-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
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....
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 ...
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 ...
9
votes
1
answer
1k
views
Why does `grep fil*` fail?
I found echo file|grep fil* fails, but echo abcd|grep abc* succeeds.
I don't understand it, can someone explain?
2
votes
4
answers
6k
views
Why does the grep command ignore the period in the search string?
The command that I am using:
find . -type f -name "*.sql" -exec grep -i -l 'schema_name.' {} +
What I want to search is all the files which contain schema_name..
But the find command is ignoring the ...
3
votes
1
answer
3k
views
cshell alias: How to use nested single quotes(') in in cshell alias
I am trying below alias in cshell:
alias sll 'ls -l \!* | grep -oE '[^ ]+$' | paste -s | xargs ls -l'
For this CSH says, Illegal variable name.
If I use \$, alias will be set without any error. But ...
1
vote
1
answer
3k
views
What does a backslash represent when searching for decimals
I want to understand what the backslash represents in this command. grep "\.900983" table
I know what the command does, it searches for the 900983 value in table, I'm just not sure of the purpose of ...
3
votes
2
answers
2k
views
How to escape metacharacters for egrep like metaquote from Perl?
Perl has a function called metaquote() to escape all special characters for a regular expression.
Is there an equivalent technique for egrep?
Example: If I am searching for the string abc.def.ghi, I ...
4
votes
1
answer
1k
views
Match pattern \\\" using grep
I have a json string inside json. This got encoded multiple times and I ended up with many escape backlashes: \\\".
The much shortened string looks like,
'[{"testId" : "12345", "message": "\\\"the ...
1
vote
2
answers
2k
views
Why does regex with \\$\{ work with egrep, but not with sed?
Given a text like this
./RFF_09 -f${FILE} -c${COND}
inside a file, this egrep command will correctly match:
egrep './RFF(.*) (.*)-c\\$\{COND\}' file
but this sed command will not
sed -n "s:'./RFF(...
2
votes
1
answer
2k
views
Regex works in shell but not through Perl script
I'm having trouble executing a Perl script through the Unix shell using Perl's system command.
I've had more complex regex commands I had to adjust accordingly to convert from Unix to Perl, and they'...
5
votes
1
answer
7k
views
command: ls /etc | sort | grep d* is yielding no results but ls /etc | sort | grep p* lists entire directory
I am playing around with piping and grep tonight. I know that grep uses regex and that * means 0 or more occurrences of the preceding character. So the way I understand it is that if I do the ...
17
votes
2
answers
24k
views
Why do I have to escape a "dot" twice?
I know that we can escape a special character like *(){}$ with \ so as to be considered literals.
For example \* or \$
But in case of . I have to do it twice, like \\. otherwise it is considered ...
8
votes
5
answers
15k
views
bash event not found trying to match and exclude parenthesis in grep
In a very long line I'll summarize with:
(foo),(bar,baz(word,right),(end)
I want to print only:
(bar,baz(word,right
To match the second parenthesis, I exclude the word that follows the third ...