LoginSignup
0
0

More than 5 years have passed since last update.

grep > cソースの関数宣言だけを抜き出す

Posted at
動作環境
Windows 7 Pro (64bit)
SmartGit 17.1.1 #11182

関数の宣言だけを抜き出す

$ cat xxx.c | grep -E ")$" | grep -v "if" | grep -v "for" | wc
79
$ cat xxx.c | grep -E ")$" | grep -v "if" | grep -v "for"  > function_list.txt

上記が有効な条件

`1. 下記のような関数宣言の記述

xxx.c
void someFunc()
{

`2. 関数名にifやforを含めていない
(grepでifやforを除くのは、if()文やfor()文がgrep検索されてしまうため)

参考

grepでこういう時はどうする? by @hirohiro77 さん

行の末尾の記載方法を参考にしました。

情報感謝です。

備考

結局、別の方法でソース構造の整理をした(秀丸エディタのアウトライン解析)。

上記の方法が有用になる時はあるだろうか?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0