How to grep '$$$$$'? [duplicate]
This question already has an answer here:
grep and escaping a dollar sign
2 answers
I want to check the absence of the following sequence of characters $$$$$ (i.e., 5 dollar signs) in a json file using grep as it has been used instead of comma to separate fields and I need to make sure this did not cause conflicts with existing similar sequence.
However, when I grep $, I get similar number of lines. It seems that $ is a special character for end of line?
How can i search for $$$$$ using grep?
Is $ a special character?
grep string search special-characters file-search
marked as duplicate by Jeff Schaller, Stephen Harris, Fabby, Sergiy Kolodyazhnyy, elbarna Dec 31 '18 at 0:15
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
grep and escaping a dollar sign
2 answers
I want to check the absence of the following sequence of characters $$$$$ (i.e., 5 dollar signs) in a json file using grep as it has been used instead of comma to separate fields and I need to make sure this did not cause conflicts with existing similar sequence.
However, when I grep $, I get similar number of lines. It seems that $ is a special character for end of line?
How can i search for $$$$$ using grep?
Is $ a special character?
grep string search special-characters file-search
marked as duplicate by Jeff Schaller, Stephen Harris, Fabby, Sergiy Kolodyazhnyy, elbarna Dec 31 '18 at 0:15
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
In addition, in shell unquoted$$is a special parameter which is replaced by the PID of the shell; this is commonly (and traditionally) used to create unique/nonconflicting names for temp-files and such.
– dave_thompson_085
Dec 30 '18 at 20:49
add a comment |
This question already has an answer here:
grep and escaping a dollar sign
2 answers
I want to check the absence of the following sequence of characters $$$$$ (i.e., 5 dollar signs) in a json file using grep as it has been used instead of comma to separate fields and I need to make sure this did not cause conflicts with existing similar sequence.
However, when I grep $, I get similar number of lines. It seems that $ is a special character for end of line?
How can i search for $$$$$ using grep?
Is $ a special character?
grep string search special-characters file-search
This question already has an answer here:
grep and escaping a dollar sign
2 answers
I want to check the absence of the following sequence of characters $$$$$ (i.e., 5 dollar signs) in a json file using grep as it has been used instead of comma to separate fields and I need to make sure this did not cause conflicts with existing similar sequence.
However, when I grep $, I get similar number of lines. It seems that $ is a special character for end of line?
How can i search for $$$$$ using grep?
Is $ a special character?
This question already has an answer here:
grep and escaping a dollar sign
2 answers
grep string search special-characters file-search
grep string search special-characters file-search
edited Dec 30 '18 at 17:14
asked Dec 30 '18 at 17:02
user9371654
2507
2507
marked as duplicate by Jeff Schaller, Stephen Harris, Fabby, Sergiy Kolodyazhnyy, elbarna Dec 31 '18 at 0:15
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Jeff Schaller, Stephen Harris, Fabby, Sergiy Kolodyazhnyy, elbarna Dec 31 '18 at 0:15
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
In addition, in shell unquoted$$is a special parameter which is replaced by the PID of the shell; this is commonly (and traditionally) used to create unique/nonconflicting names for temp-files and such.
– dave_thompson_085
Dec 30 '18 at 20:49
add a comment |
In addition, in shell unquoted$$is a special parameter which is replaced by the PID of the shell; this is commonly (and traditionally) used to create unique/nonconflicting names for temp-files and such.
– dave_thompson_085
Dec 30 '18 at 20:49
In addition, in shell unquoted
$$ is a special parameter which is replaced by the PID of the shell; this is commonly (and traditionally) used to create unique/nonconflicting names for temp-files and such.– dave_thompson_085
Dec 30 '18 at 20:49
In addition, in shell unquoted
$$ is a special parameter which is replaced by the PID of the shell; this is commonly (and traditionally) used to create unique/nonconflicting names for temp-files and such.– dave_thompson_085
Dec 30 '18 at 20:49
add a comment |
1 Answer
1
active
oldest
votes
It seems that
$is a special character for end of line?
Yep, exactly. And there's an end-of-line on each and every line.
You'll need to use $$$$$ as the pattern, or use grep -F '$$$$$', to tell grep to use the pattern as a fixed string instead of a regular expression.
Or a shorter version regex pattern: ${5} in basic regex or ${5} in extended regular expressions (grep -E).
(In basic regular expressions (plain grep), you really only need to escape the last dollar sign, so $$$$$ would do instead of $$$$$. But in extended (grep -E) and Perl regular expressions they all need to be escaped so better do that anyway.)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It seems that
$is a special character for end of line?
Yep, exactly. And there's an end-of-line on each and every line.
You'll need to use $$$$$ as the pattern, or use grep -F '$$$$$', to tell grep to use the pattern as a fixed string instead of a regular expression.
Or a shorter version regex pattern: ${5} in basic regex or ${5} in extended regular expressions (grep -E).
(In basic regular expressions (plain grep), you really only need to escape the last dollar sign, so $$$$$ would do instead of $$$$$. But in extended (grep -E) and Perl regular expressions they all need to be escaped so better do that anyway.)
add a comment |
It seems that
$is a special character for end of line?
Yep, exactly. And there's an end-of-line on each and every line.
You'll need to use $$$$$ as the pattern, or use grep -F '$$$$$', to tell grep to use the pattern as a fixed string instead of a regular expression.
Or a shorter version regex pattern: ${5} in basic regex or ${5} in extended regular expressions (grep -E).
(In basic regular expressions (plain grep), you really only need to escape the last dollar sign, so $$$$$ would do instead of $$$$$. But in extended (grep -E) and Perl regular expressions they all need to be escaped so better do that anyway.)
add a comment |
It seems that
$is a special character for end of line?
Yep, exactly. And there's an end-of-line on each and every line.
You'll need to use $$$$$ as the pattern, or use grep -F '$$$$$', to tell grep to use the pattern as a fixed string instead of a regular expression.
Or a shorter version regex pattern: ${5} in basic regex or ${5} in extended regular expressions (grep -E).
(In basic regular expressions (plain grep), you really only need to escape the last dollar sign, so $$$$$ would do instead of $$$$$. But in extended (grep -E) and Perl regular expressions they all need to be escaped so better do that anyway.)
It seems that
$is a special character for end of line?
Yep, exactly. And there's an end-of-line on each and every line.
You'll need to use $$$$$ as the pattern, or use grep -F '$$$$$', to tell grep to use the pattern as a fixed string instead of a regular expression.
Or a shorter version regex pattern: ${5} in basic regex or ${5} in extended regular expressions (grep -E).
(In basic regular expressions (plain grep), you really only need to escape the last dollar sign, so $$$$$ would do instead of $$$$$. But in extended (grep -E) and Perl regular expressions they all need to be escaped so better do that anyway.)
edited Dec 30 '18 at 21:27
answered Dec 30 '18 at 17:04
ilkkachu
56.3k784156
56.3k784156
add a comment |
add a comment |
In addition, in shell unquoted
$$is a special parameter which is replaced by the PID of the shell; this is commonly (and traditionally) used to create unique/nonconflicting names for temp-files and such.– dave_thompson_085
Dec 30 '18 at 20:49