How can I grep symbols like "minus": -
Hello, I'm not that newbie to linux but I haven't found a way to grep minus symbol (or any other symbols that might suggest a console command).
For example: A directory called abc, with subdirectories called: abc-a, def-a, ghi-a, jkl-a, and etc... If i want to list only the directories that finish with "-a" I might do: $ ls | grep -a But sintax -a might be an option switch or something, so it won't let me use it with grep. How can I grep those directories? |
1. Quote AND/OR escape
Code:
ls | grep "\-a" or 2. Use flag "--" to stop switch parsing Code:
ls | grep -- -a |
...
Nice, thanks dude...
|
Please mark as SOLVED once you have a solution.
|
Use "--" to stop option parsing.
Also, to find all files ending with "-a" it might be better just to use "ls *-a" instead. |
All times are GMT -5. The time now is 10:08 AM. |