home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4663 < prev    next >
Encoding:
Text File  |  1992-11-12  |  1.0 KB  |  51 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!gumby!wupost!csus.edu!netcom.com!hwai
  3. From: hwai@netcom.com (Howard Wai)
  4. Subject: How to specify new line char. in SED?
  5. Message-ID: <1992Nov13.004538.14259@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Date: Fri, 13 Nov 1992 00:45:38 GMT
  8. Lines: 41
  9.  
  10.  
  11. How do I specified a match of zero or more lines in a regular expresion? 
  12. Or How do I specify a new line character? 
  13.  
  14. Here's an example:
  15.  
  16. case #1:
  17.    int DBItest(a,b,c)
  18.    int a;
  19.    char b;
  20.    long c;
  21.    {
  22.     /* body of function */
  23.    }
  24.  
  25. case #2:
  26.    int DBItest( a,
  27.                 b,
  28.                 c)
  29.     int a;
  30.     char b;
  31.     char c;
  32.    {
  33.     /* body of function */
  34.    }
  35.  
  36. I want to extract everything between the keyword "int" and "{" which
  37. can be on different lines as in case #2.
  38. I was able to take care of case #1 with the following sed command.
  39.    sed -n "/^int.*(.*) */,/^{/p"  filename1
  40.  
  41. Output is:
  42.    int DBItest(a,b,c)
  43.    int a;
  44.    char b;
  45.    long c;
  46.    {
  47.  
  48. What can I do about case #2?
  49.  
  50. Thank you in advance!
  51.