home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!gumby!wupost!csus.edu!netcom.com!hwai
- From: hwai@netcom.com (Howard Wai)
- Subject: How to specify new line char. in SED?
- Message-ID: <1992Nov13.004538.14259@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Fri, 13 Nov 1992 00:45:38 GMT
- Lines: 41
-
-
- How do I specified a match of zero or more lines in a regular expresion?
- Or How do I specify a new line character?
-
- Here's an example:
-
- case #1:
- int DBItest(a,b,c)
- int a;
- char b;
- long c;
- {
- /* body of function */
- }
-
- case #2:
- int DBItest( a,
- b,
- c)
- int a;
- char b;
- char c;
- {
- /* body of function */
- }
-
- I want to extract everything between the keyword "int" and "{" which
- can be on different lines as in case #2.
- I was able to take care of case #1 with the following sed command.
- sed -n "/^int.*(.*) */,/^{/p" filename1
-
- Output is:
- int DBItest(a,b,c)
- int a;
- char b;
- long c;
- {
-
- What can I do about case #2?
-
- Thank you in advance!
-