using egrep to search a file
I, for the life of me cannot figure out how to write an egrep command to display NONEMPTY lines WITH BLANK SPACES in a file.
I have egrep -n '^ $' file This command displays lines with one blank space, but how do I display lines with any number of blank spaces? (blanks spaces only, no letters, numbers etc...) |
Code:
egrep -n '^ +$' file |
Quote:
So now what expression would you use to find blank space trailing a sentence? |
i guess that would be any line that ends with a space:
Code:
[schneidz@hyper ~]$ grep " "$ hello-world.c |
Quote:
|
i think this would be interpreted as any line that begins with a space, contains 0 or more of any character, then ends with a space:
Code:
[schneidz@hyper ~]$ grep ^" .* "$ hello-world.c |
Quote:
|
i dont think a single regex would do so maybe this will work:
Code:
[schneidz@hyper ~]$ egrep "(^ .* $| )" hello-world.c |
All times are GMT -5. The time now is 12:47 AM. |