How do I escape > in grep in a for loop???
Posted: 2023-Jul-17, 8:17 pm
I need to use grep to find the number of lines containing the sequence of characters;
">
This works when entered directly into the command line and gives me the count of matching lines;
This does not;
Nor does this;
How can I escape the greater than in the for loop so that the count gets placed into the token?
">
This works when entered directly into the command line and gives me the count of matching lines;
Code: Select all
grep -c "\">" "filename.txt"
Code: Select all
for /f %E in ('grep -c "\">" "filename.txt"') do echo %E
Code: Select all
for /f %E in ('grep -c "\"^>" "filename.txt"') do echo %E