How should I grep for a string containing a forward slash like ./.
?
相关问题
- bash delete line condition
- Read lines from a file, grep in a second file, and
- Remove all character after matched character
- grep IP adress with open port nmap
- 'grep' in PowerShell 1.0
相关文章
- What's the difference between grep -r and -R
- Ruby grep with line number
- Shell Removing Tabs/Spaces
- Match if previous line starts with character
- Write a shell script that find-greps and outputs f
- Replacing data values based on grep result in R
- How can I grep in a loop?
- Simultaneous pipe to grep and redirect to stdout
You'll just need to escape the periods with a backslash. So if I have a file
foo.txt
with contents:I can run
grep \./\. test.txt
, which should just print the two./.
lines.The forward slash is not a special character in grep, but may be in tools like sed, Ruby, or Perl. You probably want to escape your literal periods, though, and it does no harm to escape the slash. This should work in all cases: