tommym121
asked on
grep line that is start with 'int'
I like to use the 'grep' to grep all line that starts with 'int' whether there is space, tabs in front of 'int'
more filename | grep int
"|" is called the pipe sign
grep '^[ ]*int' filename
LOL I think I spoke too early.
Did you mean int as in the datatype?
Did you mean int as in the datatype?
ASKER
What I try to do is look for all line that int variable declaration line? So I need to find all integer variables declaration line.
so I have to be able to grep all these lines
int i ;
int a;
\t\t int b;
so I have to be able to grep all these lines
int i ;
int a;
\t\t int b;
do as I said earlier
more filename | grep int
more filename | grep int
there are two characters in the [ ], one is a space, ad the other is a tab
ASKER
but I do not want to pick up a line that contain 'int' in another word.
What I try to is to grep all the line with the word 'int' at the beginning of the line.
What I try to is to grep all the line with the word 'int' at the beginning of the line.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great
or simply
grep -w int filename
grep -w int filename