# reading a cpp file

**URL:** <https://community.unix.com/t/reading-a-cpp-file/233889>\
**Category:** Shell Programming and Scripting\
**Created:** [March 3, 2009, 10:51am UTC](https://community.unix.com/t/reading-a-cpp-file/233889 "2009-03-03T10:51:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultimatix](https://community.unix.com/letter_avatar/ultimatix/32/6_22734026db12803ebb3e059622ac3534.png) [@ultimatix](https://community.unix.com/u/ultimatix)\
**Post date:** [March 3, 2009, 10:51am UTC](https://community.unix.com/t/reading-a-cpp-file/233889/1 "2009-03-03T10:51:08Z")

</div>

I need to find all the methods in a cpp file ... using shell script

Pls guide me regarding the grep criteria for searching methods

I mean what are the patterns to be grepped in \*.cpp which match methods

Hope i have made myself clear

Thanks and Regards

-- Ultimatix

---

<div class="post-metadata">

**Author:** ![Shahul](https://community.unix.com/user_avatar/community.unix.com/shahul/32/1043_2.png) [@Shahul](https://community.unix.com/u/Shahul)\
**Post date:** [March 3, 2009, 10:54am UTC](https://community.unix.com/t/reading-a-cpp-file/233889/2 "2009-03-03T10:54:31Z")

</div>

what have you tried so far..

could you share ...

Thanks  
Sha

---

<div class="post-metadata">

**Author:** ![ultimatix](https://community.unix.com/letter_avatar/ultimatix/32/6_22734026db12803ebb3e059622ac3534.png) [@ultimatix](https://community.unix.com/u/ultimatix)\
**Post date:** [March 3, 2009, 10:59am UTC](https://community.unix.com/t/reading-a-cpp-file/233889/3 "2009-03-03T10:59:24Z")

</div>

what i have done is sorted the \*.cpp file according to latest timestamp using find command. i hv soted rthe value of latest path in a variable .. and then  
cd variable name ie going to that path where latest version of cpp is stored.

then I need to grep for methods like publi , private etc..

pls help me in deciding the grep pattern
