I"m trying to use the grep command to print out all occurrences of integer literals in a foo.txt file, but I can't seem to find a way how.
The only thing I can think of for this is using [0-9] as my pattern, but that prints all lines with occurrences of the number rather than just the literals.
EDIT: Say foo.txt contains:
string string1 = "Hello world";
cout << string1.at(2) << endl;
cout << string1at(3) << endl;
Then the expected output would be:
cout << string1.at(2) << endl;
cout << string1at(3) << endl;