Link to home
Start Free TrialLog in
Avatar of tommym121
tommym121Flag for Canada

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'
Avatar of yoddha
yoddha

more filename | grep int
"|" is called the pipe sign
Avatar of ozo
grep '^[   ]*int'  filename
LOL I think I spoke too early.

Did you mean int as in the datatype?
Avatar of tommym121

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;
do as I said earlier

more filename | grep int
there are two characters in the [ ], one is a space, ad the other is a tab
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.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great
or simply

grep -w int filename