반응형

흑백 사진 만들기

 

  Color 사진을 흑백으로 만든다는 것은 색의 3 속성중 명도만을 남기고 색상과, 채도를 모두 없앤다는 의미를 가집니다. Photoshop에서 흑백 사진을 만드는 방법은 여러가지가 있습니다. 모두 비슷하게 보이지만 방법에 따라 차이가 있으며 여기서는 방법에 따른 결과가 어떤 차이점이 있는지에 대해서 알아보겠습니다.

 

 

Step 1. File > Open 명령을 실행하여 준비된 이미지를 연다.


  Tip: 예제에서 사용된 이미지는 우측 상단에서 다운 받으실 수 있습니다.

 

 

 


Step 2. Layer > New > Layer 명령을 실행하여 'Layer 1'을 만들고 Edit > Fill(White) 명령을 실행한 다음 Blending Mode을 'Color'로 바꾸어 준다.

 

  Tip: Color 모드는 선택된 Blend Layer의 Hue(색상), Saturation(채도)를 사용하고 하위 Layer의 명도를 사용하는 합성방법을 사용합니다. 즉, 여기서는 Blend Layer가 색상과 채도를 모두 포함하지 않고 있기 때문에 하위 Layer의 명도만을 보여주는 결과를 가져오는 것입니다. 여기서 사용된 Blend Layer는 무채색 계열(명도만을 가진 이미지: 흑백 이미지와 그 사이의 회색 이미지)의 색상을 사용하면 모두 같은 결과를 가져옵니다.

 

 

 


Step 2. History 팔래트에서 'Create new snapshot' 버튼을 클릭하여 현재 이미지를 Snapshot으로 저장한 후 적당한 이름으로 바꾸어 준다.

 

 

 


Step 3. Layer > New > Layer 명령을 실행하여 'Layer 2'를 만들고 역시 흰색으로 채워준 다음, 'Layer 1'과 'Layer 2'를 안보이게 한다.

 

 

 


Step 4. Channels 팔레트에서 키보드 Ctrl 키를 누른 채로 RGB Channel을 클릭하여 선택 영역을 만든다.

 

  Tip: Channel에서의 선택영역 로딩은 Level 단계에 의해서만 이루어집니다. Red Channel의 경우 완전한 붉은 색인 Red 255의 경우 100% 선택이 이루어지고 Red 128의 경우는 50%의 선택이 이루어 집니다. Green, Blue Channel도 마찬가지입니다. 그 외의 RGB Channel과 Alpha Channel의 경우 명도 단계에 의해서 선택이 결정됩니다. 즉, 가장 밝은 색인 255 Level의 명도를 가졌을 경우 100% 선택이 이루어지고, 가장 어두운 색인 0 Level의 명도를 가졌을 경우 선택이 이루어지지 않습니다.

 

 

 


Step 5. Select > Inverse(단축키 Shift + Ctrl + I) 명령을 실행하여 선택 영역을 반전 한 후 Edit > Fill(Black) 명령을 실행한다.

 

  Tip: Step 4 의 과정에서 선택된 부분은 명도가 높은, 즉 밝은 부분의 선택이 이루어 진 상태입니다. 때문에 선택을 반전하여 검은 색으로 채워주는 것입니다. 위의 과정은 선택을 반전하지 않고, 검은 바탕에 흰색을 채워주어도 같은 결과를 가져옵니다.

 

 

 


Step 6. 선택을 해제한 후 역시 Snapshot으로 저장하고 적당한 이름으로 바꾸어 준다.

 

 

 


Step 7. Layer 팔레트에서 'Background'을 선택한 후 Layer > New Adjustment Layer > Hue/Saturation 명령을 실행하고 Saturation 옵션을 -100으로 한 다음 'OK' 버튼을 눌러 적용한다.

 

 

 


Step 8. 'Layer 1', 'Layer 2'를 안보이게 해 준다.

 

 

 


Step 9. Snapshot으로 저장한다.

 

 

 


Step 10. Hue/Saturation Adjustment Layer의 Blending Mode을 Color로 바꾸어 준다.

 

 

 


Step 11. Snapshot으로 저장한다.

 

 

 


Step 12. 'Background' Layer를 제외한 모든 Layer를 삭제하고 Image > Mode > Grayscale 명령을 실행한다.

 

  Tip: 이번 과정은 Color Mode을 Grayscale로 바꾸어 주는 것입니다. Grayscale Mode는 가장 밝은 상태인 255 단계와, 가장 어두운 상태인 0 단계와 그 사이의 단계만을 가지는, 모두 256 단계만을 가지는 색상 모드입니다.

 

 

 


Step 13. Snapshot으로 저장한다.

 

 

 


Step 14. History 팔레트에서 Snapshot을 차례로 선택하며 서로 비교해 본다.

 
 
 
*  Color 사진을 흑백으로 만든다는 것은 색의 3 속성중 명도만을 남기고 색상과, 채도를 모두 없앤다는 의미를 가집니다. 이 방법으로는 채도를 빼는 Desaturate 명령과 Grayscale Mode로 바꾸어 주는 명령이 가장 흔하게 사용될겁니다. 하지만 이 두 명령은 정확한 명도 단계를 유지하는 결과를 얻기 힘이 듭니다. 위의 과정에서는 Hue/Saturation 명령을 이용하여 채도를 빼주는 과정과, Color Mode을 Grayscale로 바꾸어주는 과정입니다. 다른 방법을 사용한 결과에 비해 색의 대비가 약하고 전체적으로 밝은 듯한 이미지가 만들어지기 마련입니다.
 
* 'Color Bland Layer' Snapshot과 'Color Bland Desaturate' Snapshot의 경우 같은 결과를 가져옵니다. 모두 원본의 명도만을 남기게 되기 때문입니다. 즉, 이 과정은 위에서 이야기 한 두 방법보다 정확한 명도단계를 얻을수 있습니다.
 
*  RGB Channel의 선택을 이용하는 방법도 비교적 정확한 결과를 얻을 수 있습니다. 이론적으로는 바로 위에서 설명한 것과 같은 결과를 가져와야 하지만, 좀더 어두운 이미지가 얻어집니다.
 
*  이미지라는 것은 보는이마다 느낌이 다르고, 또한 제작자의 의도에 따른 것이기때문에 위의 과정 중 어떠한 것이 옳다고는 말할 수 없습니다. 다만 여기서는 방법에 따른 결과의 차이점을 이야기 하고 있으며 어떤 방법을 사용하느냐는 각자의 몫이라고 할 수 있습니다.
 
 
반응형
반응형

이미지 내 특정 색상 바꾸기 - Replace Color

 

 

 

  Replace Color 도구의 설명은 '간단 예제따라하기' 게시판의 '특정색상 바꾸기'편에서도 설명을 드렸습니다. 자세한 설명은 '간단 예제따라하기' 게시판의 '특정색상 바꾸기'편을 참고하시기 바랍니다.

 

 

Step 1. File > Open 명령으로 보정을 원하는 이미지를 불러온다.

 

  Tip : 아래와 같은 이미지는 보정을 원하는 풍선인형의 색이 다른 배경에는 분포되어 있지 않아 비교적 쉬운 경우라 할 수 있습니다.

 

 

 

 

 

Step 2. Image > Adjustments > Replace Color 명령을 실행하고, 마우스 커서를 이미지의 색을 보정할 부분에 위치시키고 왼쪽버튼을 클릭한다.

 

  Tip : 이미지 내의 특정부분을 클릭하면 Replace Color 창의 미리보기 옵션에서 클릭한 곳의 색상이 있는 곳이 하얗게 변하는 것을 볼 수 있습니다. 이 때 하얗게 된 부분은 색상보정이 되는 곳이고 검은 부분은 되지 않는 곳입니다.

 

 

 

 

 

 

Step 3. Fuzziness 옵션에서 조절점을 조정한다.

 

  Tip : Fuzziness 옵션을 조절하면 아래의 미리보기 창의 하얀 부분이 확대되거나 축소되는 것을 볼 수 있습니다. 이 것을 이용해 적당하게 조절해 주면 됩니다.

 

 

 

 

 

Step 4. Eyedropper Tool 중 'Add to Sample'(스포이드 모양 옆에 + 가 있는 아이콘) 아이콘을 선택하고 이미지 내의 추가 보정할 부분을 클릭한다.

 

  Tip : 'Step 3'의 단계에서는 인형의 팔, 다리, 얼굴 부분은 선택이 되어 있지만 몸통 부분은 검은색으로 보정이 불가능합니다. 'Add to Sample' 옵션을 사용하여 이 부분을 클릭하면 몸통 부분까지 흰색으로 변하며 보정이 가능해지는 것을 알 수 있습니다.

Step 5. 다시 Fuzziness 옵션을 조절한다.

 

  Tip : 'Eyedropper Tool'은 'Add to Sample' 옵션 외에도 'Subtract from Sample'(스포이드 모양옆에 - 가 붙어있는 아이콘) 옵션이 있습니다. 이 옵션은 'Add to Sample'옵션의 반대 기능으로 이미 선택된 부분에서 보정이 필요 없는 부분을 빼주는 옵션입니다.

 

 

 

 

 

Step 6. 위의 과정을 반복하면서 색상을 보정할 부분을 정교하게 선택한다.

 

 

 

 

 

Step 7. Replacement 옵션의 'Hue' 옵션을 조절하여 원하는 색상으로 변경한다.

 

  Tip : Hue 옵션 오른쪽에 보면 변경되어질 색상을 보여주는 'Result' 옵션이 있습니다. 이 부분을 클릭하면 'Color Picker' 창이 뜨면서 직접 색상을 선택할 수도 있습니다.

 
 
 
  만약 위의 예에서 풍선인형과 같은 색상이 배경에도 분포되어 있다면 같이 보정이 이루어 집니다. 이럴 경우에는 미리 풍선인형을 선택하는 등의 사전 작업이 이루어 져야 합니다.
 
  이 강좌를 요청하신 분이 Channel을 이용한 방법을 물으셨는데 기본적인 원리는 같습니다. 제 생각에는 굳이 Channel을 선택하고 또, Color Mode을 바꾸는 등의 작업을 하지 않아도 된다는 생각입니다. 물론 이 방법 외에도 'Hue/Saturation' 기능을 이용하는 등의 여러 방법을 사용할 수 있습니다. 'Hue/Saturation' 기능을 이용하면 어떤 면에서는 보다 정교한 보정이 가능하겠지만, 역시 기본 원리는 같다고 할 수 있으며, 'Replace Color'의 경우 직접 보정이 되어지는 부분을 확인할 수 있다는 점에서 비교적 간단한 이미지나 또는 색상 보정이 익숙하지 않은 사용자의 경우에는 훨씬 쉽고, 매력적일 수 있다고 생각합니다. 이 외에도 CS 버전에서 추가된 'Color Replacement Tool'을 이용하는 것도 좋은 방법중의 하나가 될 수 있을겁니다.
 
 
 
 
 

http://cafe.naver.com/pstutorial 

 
반응형
반응형

{오래된 사진 수정하기}

 

 

다음 예제는 오래된 사진을 수정하는 방법에 대해 설명하고 있습니다.

지금도 마찬가지이겠지만 과거 포토샵은 사진사들에게 인기가 많은 프로그램이었다고 합니다.

과거 한 때 오래된 사진을 사진사에게 맞겨 새 사진처럼 만드는 일이 유행한 적이 있었습니다. 저희 집에서도 새롭게 복구된 사진을 보고 감탄하며 즐거워 하던 기억이 있습니다. 그때 저는 포토샵이라는 프로그램을 몰랐지만 여러분들은 부모님의 오래된 사진을 직접 수정하여 선물로 드려보는 것도 좋으리라 여깁니다.

앞의 강좌 "흑백이미지를 칼라 이미지로 바꾸기"를 함께 참고하여 오래된 흑백사진을 새로 찍은 사진처럼 만들어 보시기 바랍니다.

오래된 사진들은 색이 바래고 흠집이 생기게 마련입니다. 이 예제에서는 바랜 색을 교정하고 흠집을 없애는 방법에 대해 기술하였습니다.

예제에서 사용한 원본은 오래된 사진을 구하기 힘들어 직접 변형을 가하여 훼손시켰음을 참고하시기 바랍니다.

 

원본 사진

 

 
 
 

복구한 사진
 

 

 

 

 

1. 훼손된 이미지를 File/Open 명령으로 연다.

 

 

 

 

2. Filter/Sharpen/Sharpen 명령을 실행한다.
Tip : Sharpen Filter는 이미지를 선명하게 해 주는 도구입니다. 너무 과도하게 사용하면 이미지가

       홰손될 수 있으니 적당하게 사용하여야 합니다.

* Sharpen : 가장 낮은 단계의 Sharpen 명령.
* Sharpen Edges : 이미지의 경계부분에 Sharpen Filter를 적용
* Sharpen More : Sharpen보다 좀더 강하게 적용
* Unsharpen Mask : Sharpen이 적용될 색의 단계를 조정 가능

 

 

 

 

3. Image/Adjust/Curves 명령을 실행하고 뜨는 옵션창에서 왼쪽 그림을 참고로 그래프를 조정한다.

Tip : 오래된 사진은 대체적으로 색의 대비가 약해 선명하지 못한 이미지를 가지고 있습니다. 이 단계는 이를 보완하기 위한 작업입니다.

 

 

 

 

4. Background Layer를 복사하여 Background Copy를 만든다.

Tip : 이제 Layer를 복사하는 방법을 모르는 분들은 없으리라 여깁니다. 혹시 모르시는 분은 아래강좌를 먼저 읽어보시기 바랍니다.

 

 

 

5. Filter/Noise/Median 명령을 실행하고 뜨는 옵션창에 흠집이 뭉개질만큼 Radius 값을 적당하게 주고 OK 버튼을 누른다.

Tip : Noise Filter 그룹은 Noise(잡티)를 만들어주거나 제거해 주는 도구로 모여 있습니다. Median Filter는 명도차이가 심한 픽셀의 색을 바꾸어 주는 방법으로 Noise를 제거하는 도구입니다. 때문에 이미지가 뭉개지는 듯한 효과를 가져옵니다. Radius값을 지나치게 높게 주면 이미지가 너무 뭉개지므로 적당하게 사용하여야 합니다.

 

 

 

6. 완전히 제거되지 않은 흠은 도장툴을 사용하여 수정해 준다.

Tip : 도장툴의 자세한 사용법은 기초다지이의 - Stamp Tool 편을 참고하시기 바랍니다.

 

 

 

7. Edit/Define Pattern 명령을 실행하여 전체 이미지를 Pattern으로 등록시킨다.

Tip : Define Pattern의 설명은 "사진을 이용한 특수효과"를 참고하시기 바랍니다.

 

 

 

8. Background copy의 눈 아이콘을 클릭하여 안보이게 하여 주고 Background를 선택한다

Tool Box의 도장툴을 길 게 누르면 나타나는 확장 메뉴에서 Pattern Stamp Tool을 선택하고 상단 옵션 바 Pattern 옵션에서 전 단계에서 등록한 Pattern을 선택한다.

 

 

 

 

9. 옵션 바에서 Mode를 Lighten을 선택하고 어두운 부분의 흠을 문질러 없애준다.

Tip : Mode 옵션은 Layer파레트에 있는 Blend Mode와 같은 원리입니다. Lighten을 선택하면 원본 이미지보다 입혀질 색이 밝은 경우에만 효과가 들어가게 됩니다. 즉, 어두운 흠이 있는 부분은 등록시킨 Pattern 이미지보다 어둡기 때문에 Pattern의 이미지가 입혀지고 그 외의 부분은 같은 명도를 가지기 때문에 효과가 들어가지 않게 되는 것입니다.
Blend Mode에의 사용법은 후에 Layer에 대해 알아보면서 자세히 살펴보겠습니다.

 

 

 

 

10. 이번에는 옵션 바의 Mode옵션에서 Darken을 선택하고 밝은색의 흠을 문질러 없애준다.

Tip : Darken Mode는 Lighten Mode의 반대성질을 가진 Mode입니다.

 

 

 

11. Backgrond copy Layer를 삭제한다.

 

 

 

 

12. 다시 Background를 복사하여 새로운 Background copy를 만든다.

 

 

 

 

13. Image/Adjust/Hue/Saturation 명령을 실행하고 뜨는 대화창에서 Saturation 옵션을 높게 올려준다.

Tip : 이 과정은 Saturation (채도)을 높여주어 바랜 색을 수정하는 부분입니다. Hue/ Saturation의 자세한 설명은 "청바지 로고 만들기" 예제를 참고하시기 바랍니다.

 

 

 

14. Background copy의 Blending Mode를 Color로 바꾸어 준다.

Tip : Color Mode는 선택된 Layer의 색상을 그대로 유지하면서 아래쪽 Layer의 명도를 사용하는 합성 방법입니다. 이미지의 채도를 높여주면 명도까지 변하게 되는데 이를 보완해 주기 위해서 사용한 명령입니다.
역시 Layer에 대해 공부하면서 자세히 알아보도록 하겠습니다.

 

 

 

15. Image/ Adjust/ Curves 명령을 실행하고 적당하게 조정하여 준다.

 

 

 

 

16. 완성된 이미지

 

 
 
 
 
 
* 이 강좌는 스탭 구르미님의 강좌입니다.
 
 
반응형
반응형

1. [File]-[Open]을 하여 원하는 이미지를 꺼내주세요.

 

  

2. [Image]-[Adjustments]-[Invert]를 클릭해주세요.

 

 

 

3. 사진현상하기 전에, 네거티브 필름효과를 보실수 있으시죠? ^^

 
 
 
 
 

 

 

http://cafe.naver.com/pstutorial

반응형
반응형

출처 : 오라클 사이트

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9013.htm#SQLRF01603

GRANT

Purpose

Use the GRANT statement to grant:

  • System privileges to users and roles.

  • Roles to users and roles. Both privileges and roles are either local, global, or external. Table 18-1 lists the system privileges (organized by the database object operated upon). Table 18-2 lists Oracle Database predefined roles.

  • Object privileges for a particular object to users, roles, and PUBLIC. Table 18-3 summarizes the object privileges that you can grant on each type of object. Table 18-4 lists object privileges and the operations that they authorize.

Notes on Authorizing Database Users You can authorize database users through means other than the database and the GRANT statement.

  • Many Oracle Database privileges are granted through supplied PL/SQL and Java packages. For information on those privileges, please refer to the documentation for the appropriate package.

  • Some operating systems have facilities that let you grant roles to Oracle Database users with the initialization parameter OS_ROLES. If you choose to grant roles to users through operating system facilities, then you cannot also grant roles to users with the GRANT statement, although you can use the GRANT statement to grant system privileges to users and system privileges and roles to other roles.

See Also:

Additional Topics

Prerequisites

To grant a system privilege, you must either have been granted the system privilege with the ADMIN OPTION or have been granted the GRANT ANY PRIVILEGE system privilege.

To grant a role, you must either have been granted the role with the ADMIN OPTION or have been granted the GRANT ANY ROLE system privilege, or you must have created the role.

To grant an object privilege, you must own the object, or the owner of the object must have granted you the object privileges with the GRANT OPTION, or you must have been granted the GRANT ANY OBJECT PRIVILEGE system privilege. If you have the GRANT ANY OBJECT PRIVILEGE, then you can grant the object privilege only if the object owner could have granted the same object privilege. In this case, the GRANTOR column of the DBA_TAB_PRIVS view displays the object owner rather than the user who issued the GRANT statement.

Syntax

grant::=

Description of grant.gif follows
Description of the illustration grant.gif

(grant_system_privileges::=, grant_object_privileges::=)

grant_system_privileges::=

Description of grant_system_privileges.gif follows
Description of the illustration grant_system_privileges.gif

(grantee_clause ::=)

grant_object_privileges::=

Description of grant_object_privileges.gif follows
Description of the illustration grant_object_privileges.gif

(on_object_clause ::=, grantee_clause ::=)

on_object_clause ::=

Description of on_object_clause.gif follows
Description of the illustration on_object_clause.gif

grantee_clause ::=

Description of grantee_clause.gif follows
Description of the illustration grantee_clause.gif

Semantics

grant_system_privileges

Use these clauses to grant system privileges.

system_privilege

Specify the system privilege you want to grant. Table 18-1 lists the system privileges, organized by the database object operated upon.

  • If you grant a privilege to a user, then the database adds the privilege to the user's privilege domain. The user can immediately exercise the privilege.

  • If you grant a privilege to a role, then the database adds the privilege to the privilege domain of the role. Users who have been granted and have enabled the role can immediately exercise the privilege. Other users who have been granted the role can enable the role and exercise the privilege.

  • If you grant a privilege to PUBLIC, then the database adds the privilege to the privilege domains of each user. All users can immediately perform operations authorized by the privilege.

Oracle Database provides the ALL PRIVILEGES shortcut for granting all the system privileges listed in Table 18-1, except the SELECT ANY DICTIONARY privilege.

role

Specify the role you want to grant. You can grant an Oracle Database predefined role or a user-defined role. Table 18-2 lists the predefined roles.

  • If you grant a role to a user, then the database makes the role available to the user. The user can immediately enable the role and exercise the privileges in the privilege domain of the role.

  • If you grant a role to another role, then the database adds the privilege domain of the granted role to the privilege domain of the grantee role. Users who have been granted the grantee role can enable it and exercise the privileges in the granted role's privilege domain.

  • If you grant a role to PUBLIC, then the database makes the role available to all users. All users can immediately enable the role and exercise the privileges in the privilege domain of the role.

    See Also:

    "Granting a Role to a Role: Example" and CREATE ROLE for information on creating a user-defined role

IDENTIFIED BY Clause

Use the IDENTIFIED BY clause to specifically identify an existing user by password or to create a nonexistent user. This clause is not valid if the grantee is a role or PUBLIC. If the user specified in the grantee_clause does not exist, then the database creates the user with the password and with the privileges and roles specified in this clause.

See Also:

CREATE USER for restrictions on usernames and passwords

WITH ADMIN OPTION

Specify WITH ADMIN OPTION to enable the grantee to:

  • Grant the role to another user or role, unless the role is a GLOBAL role

  • Revoke the role from another user or role

  • Alter the role to change the authorization needed to access it

  • Drop the role

If you grant a system privilege or role to a user without specifying WITH ADMIN OPTION, and then subsequently grant the privilege or role to the user WITH ADMIN OPTION, then the user has the ADMIN OPTION on the privilege or role.

To revoke the ADMIN OPTION on a system privilege or role from a user, you must revoke the privilege or role from the user altogether and then grant the privilege or role to the user without the ADMIN OPTION.

grantee_clause

TO grantee_clause identifies users or roles to which the system privilege, role, or object privilege is granted.

Restriction on Grantees A user, role, or PUBLIC cannot appear more than once in TO grantee_clause.

PUBLIC Specify PUBLIC to grant the privileges to all users.

Restrictions on Granting System Privileges and Roles Privileges and roles are subject to the following restrictions:

  • A privilege or role cannot appear more than once in the list of privileges and roles to be granted.

  • You cannot grant a role to itself.

  • You cannot grant a role IDENTIFIED GLOBALLY to anything.

  • You cannot grant a role IDENTIFIED EXTERNALLY to a global user or global role.

  • You cannot grant roles circularly. For example, if you grant the role banker to the role teller, then you cannot subsequently grant teller to banker.

grant_object_privileges

Use these clauses to grant object privileges.

object_privilege

Specify the object privilege you want to grant. You can specify any of the values shown in Table 18-3. See also Table 18-4.

Restriction on Object Privileges A privilege cannot appear more than once in the list of privileges to be granted.

ALL [PRIVILEGES]

Specify ALL to grant all the privileges for the object that you have been granted with the GRANT OPTION. The user who owns the schema containing an object automatically has all privileges on the object with the GRANT OPTION. The keyword PRIVILEGES is provided for semantic clarity and is optional.

column

Specify the table or view column on which privileges are to be granted. You can specify columns only when granting the INSERT, REFERENCES, or UPDATE privilege. If you do not list columns, then the grantee has the specified privilege on all columns in the table or view.

For information on existing column object grants, query the USER_, ALL_, or DBA_COL_PRIVS data dictionary view.

on_object_clause

The on_object_clause identifies the object on which the privileges are granted. Directory schema objects and Java source and resource schema objects are identified separately because they reside in separate namespaces.

If you can make this grant only because you have the GRANT ANY OBJECT PRIVILEGE system privilege--that is, you are not the owner of object, nor do you have object_privilege on object WITH GRANT OPTION--then the effect of this grant is that you are acting on behalf of the object owner. The *_TAB_PRIVS data dictionary views will reflect that this grant was made by the owner of object.

See Also:

WITH GRANT OPTION

Specify WITH GRANT OPTION to enable the grantee to grant the object privileges to other users and roles.

Restriction on Granting WITH GRANT OPTION You can specify WITH GRANT OPTION only when granting to a user or to PUBLIC, not when granting to a role.

WITH HIERARCHY OPTION

Specify WITH HIERARCHY OPTION to grant the specified object privilege on all subobjects of object, such as subviews created under a view, including subobjects created subsequent to this statement.

This clause is meaningful only in combination with the SELECT object privilege.

object Specify the schema object on which the privileges are to be granted. If you do not qualify object with schema, then the database assumes the object is in your own schema. The object can be one of the following types:

  • Table, view, or materialized view

  • Sequence

  • Procedure, function, or package

  • User-defined type

  • Synonym for any of the preceding items

  • Directory, library, operator, or indextype

  • Java source, class, or resource

You cannot grant privileges directly to a single partition of a partitioned table.

DIRECTORY directory_name Specify a directory schema object on which privileges are to be granted. You cannot qualify directory_name with a schema name.

JAVA SOURCE | RESOURCE The JAVA clause lets you specify a Java source or resource schema object on which privileges are to be granted.

See Also:

CREATE JAVA

Listings of System and Object Privileges

Note:

When you grant a privilege on ANY object, such as CREATE ANY CLUSTER, the result is determined by the value of the O7_DICTIONARY_ACCESSIBILITY initialization parameter. By default, this parameter is set to FALSE, so that ANY privileges give the grantee access to that type of object in all schemas except the SYS schema. If you set O7_DICTIONARY_ACCESSIBILITY to TRUE, then the ANY privileges also give the grantee access, in the SYS schema, to all objects except Oracle Scheduler objects. For security reasons, Oracle recommends that you use this setting only with great caution.

Table 18-1 System Privileges

System Privilege Name Operations Authorized

Advisor Framework Privileges: All of the advisor framework privileges are part of the DBA role.

--

ADVISOR

Access the advisor framework through PL/SQL packages such as DBMS_ADVISOR and DBMS_SQLTUNE.

Please refer to PL/SQL Packages and Types Reference for information on these packages.

ADMINISTER SQL TUNING SET

Create, drop, select (read), load (write), and delete a SQL tuning set owned by the grantee through the DBMS_SQLTUNE package.

ADMINISTER ANY SQL TUNING SET

Create, drop, select (read), load (write), and delete a SQL tuning set owned by any user through the DBMS_SQLTUNE package.

CREATE ANY SQL PROFILE

Accept a SQL Profile recommended by the SQL Tuning Advisor, which is accessed through Enterprise Manager or by the DBMS_SQLTUNE package.

DROP ANY SQL PROFILE

Drop an existing SQL Profile.

ALTER ANY SQL PROFILE

Alter the attributes of an existing SQL Profile.

CLUSTERS:

--

CREATE CLUSTER

Create clusters in the grantee's schema.

CREATE ANY CLUSTER

Create a cluster in any schema. Behaves similarly to CREATE ANY TABLE.

ALTER ANY CLUSTER

Alter clusters in any schema.

DROP ANY CLUSTER

Drop clusters in any schema.

CONTEXTS:

--

CREATE ANY CONTEXT

Create any context namespace.

DROP ANY CONTEXT

Drop any context namespace.

DATABASE:

--

ALTER DATABASE

Alter the database.

ALTER SYSTEM

Issue ALTER SYSTEM statements.

AUDIT SYSTEM

Issue AUDIT statements.

DATABASE LINKS:

--

CREATE DATABASE LINK

Create private database links in the grantee's schema.

CREATE PUBLIC DATABASE LINK

Create public database links.

DROP PUBLIC DATABASE LINK

Drop public database links.

DEBUGGING:

--

DEBUG CONNECT SESSION

Connect the current session to a debugger.

DEBUG ANY PROCEDURE

Debug all PL/SQL and Java code in any database object. Display information on all SQL statements executed by the application.

Note: Granting this privilege is equivalent to granting the DEBUG object privilege on all applicable objects in the database.

DIMENSIONS:

--

CREATE DIMENSION

Create dimensions in the grantee's schema.

CREATE ANY DIMENSION

Create dimensions in any schema.

ALTER ANY DIMENSION

Alter dimensions in any schema.

DROP ANY DIMENSION

Drop dimensions in any schema.

DIRECTORIES:

--

CREATE ANY DIRECTORY

Create directory database objects.

DROP ANY DIRECTORY

Drop directory database objects.

INDEXTYPES:

--

CREATE INDEXTYPE

Create an indextype in the grantee's schema.

CREATE ANY INDEXTYPE

Create an indextype in any schema and create a comment on an indextype in any schema.

ALTER ANY INDEXTYPE

Modify indextypes in any schema.

DROP ANY INDEXTYPE

Drop an indextype in any schema.

EXECUTE ANY INDEXTYPE

Reference an indextype in any schema.

INDEXES:

--

CREATE ANY INDEX

Create in any schema a domain index or an index on any table in any schema.

ALTER ANY INDEX

Alter indexes in any schema.

DROP ANY INDEX

Drop indexes in any schema.

JOB SCHEDULER OBJECTS:

The following privileges are needed to execute procedures in the DBMS_SCHEDULER package.

CREATE JOB

Create jobs, schedules, or programs in the grantee's schema.

CREATE ANY JOB

Create, alter, or drop jobs, schedules, or programs in any schema.

Note: This extremely powerful privilege allows the grantee to execute code as any other user. It should be granted with caution.

CREATE EXTERNAL JOB

Create in the grantee's schema an executable scheduler job that runs on the operating system.

EXECUTE ANY PROGRAM

Use any program in a job in the grantee's schema.

EXECUTE ANY CLASS

Specify any job class in a job in the grantee's schema.

MANAGE SCHEDULER

Create, alter, or drop any job class, window, or window group.

LIBRARIES:

--

CREATE LIBRARY

Create external procedure or function libraries in the grantee's schema.

CREATE ANY LIBRARY

Create external procedure or function libraries in any schema.

DROP ANY LIBRARY

Drop external procedure or function libraries in any schema.

MATERIALIZED VIEWS:

--

CREATE MATERIALIZED VIEW

Create a materialized view in the grantee's schema.

CREATE ANY MATERIALIZED VIEW

Create materialized views in any schema.

ALTER ANY MATERIALIZED VIEW

Alter materialized views in any schema.

DROP ANY MATERIALIZED VIEW

Drop materialized views in any schema.

QUERY REWRITE

This privilege has been deprecated. No privileges are needed for a user to enable rewrite for a materialized view that references tables or views in the user's own schema.

GLOBAL QUERY REWRITE

Enable rewrite using a materialized view when that materialized view references tables or views in any schema.

ON COMMIT REFRESH

Create a refresh-on-commit materialized view on any table in the database.

Alter a refresh-on-demand materialized on any table in the database to refresh-on-commit.

FLASHBACK ANY TABLE

Issue a SQL Flashback Query on any table, view, or materialized view in any schema. This privilege is not needed to execute the DBMS_FLASHBACK procedures.

OPERATORS:

--

CREATE OPERATOR

Create an operator and its bindings in the grantee's schema.

CREATE ANY OPERATOR

Create an operator and its bindings in any schema and create a comment on an operator in any schema.

ALTER ANY OPERATOR

Modify an operator in any schema.

DROP ANY OPERATOR

Drop an operator in any schema.

EXECUTE ANY OPERATOR

Reference an operator in any schema.

OUTLINES:

--

CREATE ANY OUTLINE

Create public outlines that can be used in any schema that uses outlines.

ALTER ANY OUTLINE

Modify outlines.

DROP ANY OUTLINE

Drop outlines.

PROCEDURES:

--

CREATE PROCEDURE

Create stored procedures, functions, and packages in the grantee's schema.

CREATE ANY PROCEDURE

Create stored procedures, functions, and packages in any schema.

ALTER ANY PROCEDURE

Alter stored procedures, functions, or packages in any schema.

DROP ANY PROCEDURE

Drop stored procedures, functions, or packages in any schema.

EXECUTE ANY PROCEDURE

Execute procedures or functions, either standalone or packaged.

Reference public package variables in any schema.

PROFILES:

--

CREATE PROFILE

Create profiles.

ALTER PROFILE

Alter profiles.

DROP PROFILE

Drop profiles.

ROLES:

--

CREATE ROLE

Create roles.

ALTER ANY ROLE

Alter any role in the database.

DROP ANY ROLE

Drop roles.

GRANT ANY ROLE

Grant any role in the database.

ROLLBACK SEGMENTS:

--

CREATE ROLLBACK SEGMENT

Create rollback segments.

ALTER ROLLBACK SEGMENT

Alter rollback segments.

DROP ROLLBACK SEGMENT

Drop rollback segments.

SEQUENCES:

--

CREATE SEQUENCE

Create sequences in the grantee's schema.

CREATE ANY SEQUENCE

Create sequences in any schema.

ALTER ANY SEQUENCE

Alter any sequence in the database.

DROP ANY SEQUENCE

Drop sequences in any schema.

SELECT ANY SEQUENCE

Reference sequences in any schema.

SESSIONS:

--

CREATE SESSION

Connect to the database.

ALTER RESOURCE COST

Set costs for session resources.

ALTER SESSION

Issue ALTER SESSION statements.

RESTRICTED SESSION

Logon after the instance is started using the SQL*Plus STARTUP RESTRICT statement.

SNAPSHOTS:

See MATERIALIZED VIEWS

SYNONYMS:

--

CREATE SYNONYM

Create synonyms in the grantee's schema.

CREATE ANY SYNONYM

Create private synonyms in any schema.

CREATE PUBLIC SYNONYM

Create public synonyms.

DROP ANY SYNONYM

Drop private synonyms in any schema.

DROP PUBLIC SYNONYM

Drop public synonyms.

TABLES:

Note: For external tables, the only valid privileges are CREATE ANY TABLE, ALTER ANY TABLE, DROP ANY TABLE, and SELECT ANY TABLE.

CREATE TABLE

Create tables in the grantee's schema.

CREATE ANY TABLE

Create tables in any schema. The owner of the schema containing the table must have space quota on the tablespace to contain the table.

ALTER ANY TABLE

Alter any table or view in any schema.

BACKUP ANY TABLE

Use the Export utility to incrementally export objects from the schema of other users.

DELETE ANY TABLE

Delete rows from tables, table partitions, or views in any schema.

DROP ANY TABLE

Drop or truncate tables or table partitions in any schema.

INSERT ANY TABLE

Insert rows into tables and views in any schema.

LOCK ANY TABLE

Lock tables and views in any schema.

SELECT ANY TABLE

Query tables, views, or materialized views in any schema.

FLASHBACK ANY TABLE

Issue a SQL Flashback Query on any table, view, or materialized view in any schema. This privilege is not needed to execute the DBMS_FLASHBACK procedures.

UPDATE ANY TABLE

Update rows in tables and views in any schema.

TABLESPACES:

--

CREATE TABLESPACE

Create tablespaces.

ALTER TABLESPACE

Alter tablespaces.

DROP TABLESPACE

Drop tablespaces.

MANAGE TABLESPACE

Take tablespaces offline and online and begin and end tablespace backups.

UNLIMITED TABLESPACE

Use an unlimited amount of any tablespace. This privilege overrides any specific quotas assigned. If you revoke this privilege from a user, then the user's schema objects remain but further tablespace allocation is denied unless authorized by specific tablespace quotas. You cannot grant this system privilege to roles.

TRIGGERS:

--

CREATE TRIGGER

Create a database trigger in the grantee's schema.

CREATE ANY TRIGGER

Create database triggers in any schema.

ALTER ANY TRIGGER

Enable, disable, or compile database triggers in any schema.

DROP ANY TRIGGER

Drop database triggers in any schema.

ADMINISTER DATABASE TRIGGER

Create a trigger on DATABASE. You must also have the CREATE TRIGGER or CREATE ANY TRIGGER system privilege.

TYPES:

--

CREATE TYPE

Create object types and object type bodies in the grantee's schema.

CREATE ANY TYPE

Create object types and object type bodies in any schema.

ALTER ANY TYPE

Alter object types in any schema.

DROP ANY TYPE

Drop object types and object type bodies in any schema.

EXECUTE ANY TYPE

Use and reference object types and collection types in any schema, and invoke methods of an object type in any schema if you make the grant to a specific user. If you grant EXECUTE ANY TYPE to a role, then users holding the enabled role will not be able to invoke methods of an object type in any schema.

UNDER ANY TYPE

Create subtypes under any nonfinal object types.

USERS:

--

CREATE USER

Create users. This privilege also allows the creator to:

  • Assign quotas on any tablespace.

  • Set default and temporary tablespaces.

  • Assign a profile as part of a CREATE USER statement.

ALTER USER

Alter any user. This privilege authorizes the grantee to:

  • Change another user's password or authentication method.

  • Assign quotas on any tablespace.

  • Set default and temporary tablespaces.

  • Assign a profile and default roles.

DROP USER

Drop users

VIEWS:

--

CREATE VIEW

Create views in the grantee's schema.

CREATE ANY VIEW

Create views in any schema.

DROP ANY VIEW

Drop views in any schema.

UNDER ANY VIEW

Create subviews under any object views.

FLASHBACK ANY TABLE

Issue a SQL Flashback Query on any table, view, or materialized view in any schema. This privilege is not needed to execute the DBMS_FLASHBACK procedures.

MERGE ANY VIEW

If a user has been granted the MERGE ANY VIEW privilege, then for any query issued by that user, the optimizer can use view merging to improve query performance without performing the checks that would otherwise be performed to ensure that view merging does not violate any security intentions of the view creator. See also Oracle Database Reference for information on the OPTIMIZER_SECURE_VIEW_MERGING parameter and Oracle Database Performance Tuning Guide for information on view merging.

MISCELLANEOUS:

--

ANALYZE ANY

Analyze any table, cluster, or index in any schema.

AUDIT ANY

Audit any object in any schema using AUDIT schema_objects statements.

CHANGE NOTIFICATION

Create a registration on queries and receive database change notifications in response to DML or DDL changes to the objects associated with the registered queries. Please refer to Oracle Database Application Developer's Guide - Fundamentals for more information on database change notification.

COMMENT ANY TABLE

Comment on any table, view, or column in any schema.

EXEMPT ACCESS POLICY

Bypass fine-grained access control.

Caution: This is a very powerful system privilege, as it lets the grantee bypass application-driven security policies. Database administrators should use caution when granting this privilege.

FORCE ANY TRANSACTION

Force the commit or rollback of any in-doubt distributed transaction in the local database.

Induce the failure of a distributed transaction.

FORCE TRANSACTION

Force the commit or rollback of the grantee's in-doubt distributed transactions in the local database.

GRANT ANY OBJECT PRIVILEGE

Grant any object privilege that the object owner is permitted to to grant.

Revoke any object privilege that was granted by the object owner or by some other user with the GRANT ANY OBJECT PRIVILEGE privilege.

GRANT ANY PRIVILEGE

Grant any system privilege.

RESUMABLE

Enable resumable space allocation.

SELECT ANY DICTIONARY

Query any data dictionary object in the SYS schema. This privilege lets you selectively override the default FALSE setting of the O7_DICTIONARY_ACCESSIBILITY initialization parameter.

SELECT ANY TRANSACTION

Query the contents of the FLASHBACK_TRANSACTION_QUERY view.

Caution: This is a very powerful system privilege, as it lets the grantee view all data in the database, including past data. This privilege should be granted only to users who need to use the Oracle Flashback Transaction Query feature.

SYSDBA

Perform STARTUP and SHUTDOWN operations.

ALTER DATABASE: open, mount, back up, or change character set.

CREATE DATABASE.

ARCHIVELOG and RECOVERY.

CREATE SPFILE.

Includes the RESTRICTED SESSION privilege.

SYSOPER

Perform STARTUP and SHUTDOWN operations.

ALTER DATABASE: open, mount, or back up.

ARCHIVELOG and RECOVERY.

CREATE SPFILE.

Includes the RESTRICTED SESSION privilege.

CONNECT, RESOURCE, and DBA

These roles are provided for compatibility with previous versions of Oracle Database. You can determine the privileges encompassed by these roles by querying the DBA_SYS_PRIVS data dictionary view.

Note: Oracle recommends that you design your own roles for database security rather than relying on these roles. These roles may not be created automatically by future versions of Oracle Database.

See Also: Oracle Database Reference for a description of the DBA_SYS_PRIVS view

DELETE_CATALOG_ROLE EXECUTE_CATALOG_ROLE SELECT_CATALOG_ROLE

These roles are provided for accessing data dictionary views and packages.

See Also: Oracle Database Administrator's Guide for more information on these roles

EXP_FULL_DATABASE

IMP_FULL_DATABASE

These roles are provided for convenience in using the import and export utilities.

See Also: Oracle Database Utilities for more information on these roles

AQ_USER_ROLE

AQ_ADMINISTRATOR_ROLE

You need these roles to use Oracle Advanced Queuing.

See Also: Oracle Streams Advanced Queuing User's Guide and Reference for more information on these roles

SNMPAGENT

This role is used by the Enterprise Manager Intelligent Agent.

See Also: Oracle Enterprise Manager Administrator's Guide

RECOVERY_CATALOG_OWNER

You need this role to create a user who owns a recovery catalog.

See Also: Oracle Database Backup and Recovery Advanced User's Guide for more information on recovery catalogs


Table 18-2 Oracle Database Predefined Roles

Predefined Role Purpose

HS_ADMIN_ROLE

A DBA using Oracle Database heterogeneous services needs this role to access appropriate tables in the data dictionary.

See Also: Oracle Database Heterogeneous Connectivity Administrator's Guide for more information

SCHEDULER_ADMIN

This role allows the grantee to execute the procedures of the DBMS_SCHEDULER package. It includes all of the job scheduler system privileges and is included in the DBA role.

See Also: Oracle Database Administrator's Guide for more information on the DBMS_SCHEDULER package


Table 18-3 Object Privileges Available for Particular Objects

Object Privilege Table View Sequence Procedure, Function, Package (Note 1) Material-ized View Directory Library User- defined Type Operator Indextype

ALTER (Note 2)

X

--

X

--

--

--

--

--

--

--

DELETE

X

X

--

--

X

(Note 3)

--

--

--

--

--

EXECUTE

--

--

--

X

(Note 2)

--

--

X

(Note 2)

X

(Note 2)

X

(Note 2)

X

(Note 2)

DEBUG

X

X

--

X

--

--

--

X

--

--

FLASHBACK

X

X

--

--

X

--

--

--

--

--

INDEX

X

--

--

--

--

--

--

--

--

--

INSERT

X

X

--

--

X

(Note 3)

--

--

--

--

--

ON COMMIT REFRESH

X

--

--

--

--

--

--

--

--

--

QUERY REWRITE

X

--

--

--

--

--

--

--

--

--

READ

--

--

--

--

--

X

--

--

--

--

REFERENCES

X

X

--

--

--

--

--

--

--

--

SELECT

X

X

X

--

X

--

--

--

--

--

UNDER

--

X

--

--

--

--

--

X

--

--

UPDATE

X

X

--

--

X (Note 3)

--

--

--

--

--

WRITE

--

--

--

--

--

X

--

--

--

--


Note 1: Oracle Database treats a Java class, source, or resource as if it were a procedure for purposes of granting object privileges.

Note 2: Job scheduler objects are created using the DBMS_SCHEDULER package. After these objects are created, you can grant the EXECUTE object privilege on job scheduler classes and programs. You can grant ALTER privilege on job scheduler jobs, programs, and schedules.

Note 3: The DELETE, INSERT, and UPDATE privileges can be granted only to updatable materialized views.

Table 18-4 Object Privileges and the Operations They Authorize

Object Privilege Operations Authorized

TABLE PRIVILEGES

The following table privileges authorize operations on a table. Any one of following object privileges allows the grantee to lock the table in any lock mode with the LOCK TABLE statement.

Note: For external tables, the only valid object privileges are ALTER and SELECT.

ALTER

Change the table definition with the ALTER TABLE statement.

DELETE

Remove rows from the table with the DELETE statement.

Note: You must grant the SELECT privilege on the table along with the DELETE privilege if the table is on a remote database.

DEBUG

Access, through a debugger:

  • PL/SQL code in the body of any triggers defined on the table

  • Information on SQL statements that reference the table directly

INDEX

Create an index on the table with the CREATE INDEX statement.

INSERT

Add new rows to the table with the INSERT statement.

REFERENCES

Create a constraint that refers to the table. You cannot grant this privilege to a role.

SELECT

Query the table with the SELECT statement.

UPDATE

Change data in the table with the UPDATE statement.

Note: You must grant the SELECT privilege on the table along with the UPDATE privilege if the table is on a remote database.

VIEW PRIVILEGES

The following view privileges authorize operations on a view. Any one of the following object privileges allows the grantee to lock the view in any lock mode with the LOCK TABLE statement.

To grant a privilege on a view, you must have that privilege with the GRANT OPTION on all of the base tables of the view.

DEBUG

Access, through a debugger:

  • PL/SQL code in the body of any triggers defined on the view

  • Information on SQL statements that reference the view directly

DELETE

Remove rows from the view with the DELETE statement.

INSERT

Add new rows to the view with the INSERT statement.

REFERENCES

Define foreign key constraints on the view.

SELECT

Query the view with the SELECT statement.

UNDER

Create a subview under this view. You can grant this object privilege only if you have the UNDER ANY VIEW privilege WITH GRANT OPTION on the immediate superview of this view.

UPDATE

Change data in the view with the UPDATE statement.

SEQUENCE PRIVILEGES

The following sequence privileges authorize operations on a sequence.

ALTER

Change the sequence definition with the ALTER SEQUENCE statement.

SELECT

Examine and increment values of the sequence with the CURRVAL and NEXTVAL pseudocolumns.

PROCEDURE, FUNCTION, PACKAGE PRIVILEGES

The following procedure, function, and package privileges authorize operations on procedures, functions, and packages. These privileges also apply to Java sources, classes, and resources, which Oracle Database treats as though they were procedures for purposes of granting object privileges.

DEBUG

Access, through a debugger, all public and nonpublic variables, methods, and types defined on the object.

Place a breakpoint or stop at a line or instruction boundary within the procedure, function, or package. This privilege grants access to the declarations in the method or package specification and body.

EXECUTE

Execute the procedure or function directly, or access any program object declared in the specification of a package, or compile the object implicitly during a call to a currently invalid or uncompiled function or procedure. This privilege does not allow the grantee to explicitly compile using ALTER PROCEDURE or ALTER FUNCTION. For explicit compilation you need the appropriate ALTER system privilege.

Access, through a debugger, public variables, types, and methods defined on the procedure, function, or package. This privilege grants access to the declarations in the method or package specification only.

Note: Users do not need this privilege to execute a procedure, function, or package indirectly.

See Also: Oracle Database Concepts and Oracle Database Application Developer's Guide - Fundamentals

MATERIALIZED VIEW PRIVILEGES

The following materialized view privileges authorize operations on a materialized view.

ON COMMIT REFRESH

Create a refresh-on-commit materialized view on the specified table.

QUERY REWRITE

Create a materialized view for query rewrite using the specified table.

SELECT

Query the materialized view with the SELECT statement.

SYNONYM PRIVILEGES

Synonym privileges are the same as the privileges for the base object. Granting a privilege on a synonym is equivalent to granting the privilege on the base object. Similarly, granting a privilege on a base object is equivalent to granting the privilege on all synonyms for the object. If you grant to a user a privilege on a synonym, then the user can use either the synonym name or the base object name in the SQL statement that exercises the privilege.

DIRECTORY PRIVILEGES

The following directory privileges provide secured access to the files stored in the operating system directory to which the directory object serves as a pointer. The directory object contains the full path name of the operating system directory where the files reside. Because the files are actually stored outside the database, Oracle Database server processes also need to have appropriate file permissions on the file system server. Granting object privileges on the directory database object to individual database users, rather than on the operating system, allows the database to enforce security during file operations.

READ

Read files in the directory.

WRITE

Write files in the directory. This privilege is useful only in connection with external tables. It allows the grantee to determine whether the external table agent can write a log file or a bad file to the directory.

Restriction: This privilege does not allow the grantee to write to a BFILE.

LIBRARY PRIVILEGE

The following library privilege authorizes operations on a library.

EXECUTE

Use and reference the specified object and invoke its methods.

OBJECT TYPE PRIVILEGES

The following object type privileges authorize operations on a database object type.

DEBUG

Access, through a debugger, all public and nonpublic variables, methods, and types defined on the object type.

Place a breakpoint or stop at a line or instruction boundary within the type body.

EXECUTE

Use and reference the specified object and invoke its methods.

Access, through a debugger, public variables, types, and methods defined on the object type.

UNDER

Create a subtype under this type. You can grant this object privilege only if you have the UNDER ANY TYPE privilege WITH GRANT OPTION on the immediate supertype of this type.

INDEXTYPE PRIVILEGE

The following indextype privilege authorizes operations on indextypes.

EXECUTE

Reference an indextype.

OPERATOR PRIVILEGE

The following operator privilege authorizes operations on user-defined operators.

EXECUTE

Reference an operator.


Examples

Granting a System Privilege to a User: Example To grant the CREATE SESSION system privilege to the sample user hr, allowing hr to log on to Oracle Database, issue the following statement:

GRANT CREATE SESSION 
   TO hr; 

Granting System Privileges to a Role: Example The following statement grants appropriate system privileges to a data warehouse manager role, which was created in the "Creating a Role: Example":

GRANT
     CREATE ANY MATERIALIZED VIEW
   , ALTER ANY MATERIALIZED VIEW
   , DROP ANY MATERIALIZED VIEW
   , QUERY REWRITE
   , GLOBAL QUERY REWRITE
   TO dw_manager
   WITH ADMIN OPTION;

The dw_manager privilege domain now contains the system privileges related to materialized views.

Granting a Role with the Admin Option: Example To grant the dw_manager role with the ADMIN OPTION to the sample user sh, issue the following statement:

GRANT dw_manager 
   TO sh 
   WITH ADMIN OPTION; 

User sh can now perform the following operations with the dw_manager role:

  • Enable the role and exercise any privileges in the privilege domain of the role, including the CREATE MATERIALIZED VIEW system privilege

  • Grant and revoke the role to and from other users

  • Drop the role

Granting Object Privileges to a Role: Example The following example grants the SELECT object privileges to a data warehouse user role, which was created in the "Creating a Role: Example":

GRANT SELECT ON sh.sales TO warehouse_user;

Granting a Role to a Role: Example The following statement grants the warehouse_user role to the dw_manager role. Both roles were created in the "Creating a Role: Example":

GRANT warehouse_user TO dw_manager; 

The dw_manager role now contains all of the privileges in the domain of the warehouse_user role.

Granting an Object Privilege on a Directory: Example To grant READ on directory bfile_dir to user hr, with the GRANT OPTION, issue the following statement:

GRANT READ ON DIRECTORY bfile_dir TO hr
   WITH GRANT OPTION;

Granting Object Privileges on a Table to a User: Example To grant all privileges on the table oe.bonuses, which was created in "Merging into a Table: Example", to the user hr with the GRANT OPTION, issue the following statement:

GRANT ALL ON bonuses TO hr 
   WITH GRANT OPTION; 

The user hr can subsequently perform the following operations:

  • Exercise any privilege on the bonuses table

  • Grant any privilege on the bonuses table to another user or role

Granting Object Privileges on a View: Example To grant SELECT and UPDATE privileges on the view emp_view, which was created in "Creating a View: Example", to all users, issue the following statement:

GRANT SELECT, UPDATE 
   ON emp_view TO PUBLIC; 

All users can subsequently query and update the view of employee details.

Granting Object Privileges to a Sequence in Another Schema: Example To grant SELECT privilege on the customers_seq sequence in the schema oe to the user hr, issue the following statement:

GRANT SELECT 
   ON oe.customers_seq TO hr; 

The user hr can subsequently generate the next value of the sequence with the following statement:

SELECT oe.customers_seq.NEXTVAL 
   FROM DUAL; 

Granting Multiple Object Privileges on Individual Columns: Example To grant to user oe the REFERENCES privilege on the employee_id column and the UPDATE privilege on the employee_id, salary, and commission_pct columns of the employees table in the schema hr, issue the following statement:

GRANT REFERENCES (employee_id), 
      UPDATE (employee_id, salary, commission_pct) 
   ON hr.employees
   TO oe; 

The user oe can subsequently update values of the employee_id, salary, and commission_pct columns. User oe can also define referential integrity constraints that refer to the employee_id column. However, because the GRANT statement lists only these columns, oe cannot perform operations on any of the other columns of the employees table.

For example, oe can create a table with a constraint:

CREATE TABLE dependent 
   (dependno   NUMBER, 
    dependname VARCHAR2(10), 
    employee   NUMBER 
   CONSTRAINT in_emp REFERENCES hr.employees(employee_id) );

The constraint in_emp ensures that all dependents in the dependent table correspond to an employee in the employees table in the schema hr.

반응형

'Database > ORACLE' 카테고리의 다른 글

rman Tool  (0) 2010.02.01
WS1-2-ch18. Data Pump (expdp/impdp) overview  (0) 2010.02.01
`BIN$+......==$0` 알수 없는 테이블..  (0) 2010.01.14
sqlplus 환경 설정  (0) 2010.01.08
Partition Table  (0) 2009.12.29
반응형

ps auxc와 ps aux를 비교해서 수상쩍은 프로세스를 감시할 수도 있다. 이 작업을 편하게 하기 위해 스크립트를 만들었다. 아래 내용을 복사해서 셸 스크립트를 작성한다.

#!/bin/bash
temp1=`mktemp`;
temp2=`mktemp`;

/bin/ps auxc |awk 'NR != 1{for (i = 11; i<=NF; i++) a=a" "$i; print $2,$1,a; a=""}'|sort -n > $temp1
/bin/ps aux |awk 'NR != 1{for (i = 11; i<=NF; i++) a=a" "$i; print $2,$1,a; a=""}'|sort -n > $temp2

echo -e "ps auxc\nps aux"
awk '
{
if (!a[$1]) {
for (i=2; i<=NF;i++){
p = p" "$i;
}
a[$1] = a[$1]" "p;
indexes[CNT++] = $1;
p = "";
} else {
len = length($1);
blank = " ";
for (i=0; i<len; i++){
blank = blank" ";
}
a[$1] = a[$1]"\n"blank;
for (i = 2; i<=NF;i++){
p = p" "$i
}
a[$1] = a[$1]" "p;
p = "";

}
} END {
for (i=0;i<CNT;i++) {
print indexes[i],a[indexes[i]];
}
}' $temp1 $temp2



rm $temp1 $temp2

출처 : http://rhdxmr.tistory.com/60
반응형

'OS > Linux' 카테고리의 다른 글

CENTOS 7에 XRDP 설치하기  (0) 2017.08.26
리눅스 백업 및 복구  (0) 2013.01.25
삼성 컴퓨터 유분투 설치기.  (0) 2012.02.06
rkhunter (리눅스 침입 탐지 사용하기)  (1) 2010.10.14
AWK & SED chunk_1  (0) 2010.01.21
반응형
 
AWK와 SED는 비슷한 또래의 사촌이다. 유닉스 초창기에 개발됐고 훌륭한 기능을 제공하므로 1979년 이후 다양한 유닉스 변종들과 유닉스-like 운영체제에 꼭 포함돼 많은 사랑을 받아왔다. 둘이 맡은 역할은 텍스트 프로세싱이다. 유닉스 프로그램들은 데이터를 일반 텍스트 파일로 저장하는 경우가 많기 때문에 유닉스 환경에서 AWK와 SED를 활용함으로써 처리할 수 있는 작업은 종류를 셀 수 없을 것이다. 게다가 파이프라인이 가능하므로 표준 출력을 AWK와 SED의 표준 입력으로 받아 처리 할 수 있으므로 텍스트가 들어가는 모든 작업에 사용될 수 있다해도 과언은 아니다. 이 둘은 헤아릴 수 없이 많이 카피돼 지난 한 세대 동안 메인프레임이나 대형 서버에서 프로세스로서 숨쉬어왔다. 하지만 80년대 중반에 더 강력한 기능을 제공하는 펄이 등장했고 그후로 AWK와 SED의 인기는 점점 사그라들었다. 게다가 AWK와 SED의 스크립트를 작성하기도 해석하기도 어렵기 때문에 조금이라도 복잡한 스크립트를 프로그래밍할 필요가 생기면 펄이나 파이썬을 추천하는 추세다. 

그러나 더 강력한 기능과 더 나은 개발 용이성을 제공하는 언어의 등장에도 불구하고 AWK와 SED는
30년 넘게 살아남았다. 대체 그 이유가 뭘까? 유닉스 초창기에 대한 향수 때문에 올드 프로그래머들이 사용하는 걸까? 아니면 복잡한 프로그래밍을 즐기는 소수 마니아들이 끈질기게 그 둘을 놓지 않기 때문일까? 아마 직접 써보면 알게 될 것이다.


이 문서의 목적
AWK와 SED에 처음 발을 들여놓는 사람들을 위한 가이드라인이다. AWK나 SED의 모든 기능을 다루지는 않았고, 문서 곳곳에서 '그밖의 내용은 맨페이지를 참고하라'는 식의 말이 나온다. AWK와 SED에 필수적인 내용을 조감하기 위함이다.

현재 문서 버전

2009년 11월 24일 버전 <- 현재
2009년 11월 21일 버전

AWK와 SED는 사용하기 어렵다?
많은 이들이 AWK와 SED로 작성된 스크립트를 보고 해석하기 난해해 하는 이유는 많은 사용자들이 AWK와 SED가 프로그래밍 언어인지 모르기 때문이라 생각한다. 사용방법이 비교적 간단해서 금방 배울 수 있는 유틸리티와 혼동하여 "AWK나 SED도 유틸리티인데 이걸 공부할 필요까진 없다" 라고 착각하기 때문에, 유틸리티 치고는 AWK와 SED 는 어렵다고 손사래 치는 것이다. 그러나 AWK나 SED도 엄연히 프로그래밍 언어고 어느 정도의 지식이 있어야 사용할 수 있다. 하지만 언어치고는 습득에 걸리는 시간이 길지 않고, 이 짧은 문서에 많은 내용을 담을 수 있을만큼 알아야할 것이 많지 않기 때문에 어려울 거란 염려는 넣어두시라. ;)

작성자
정준영; 이 문서는 2009년 11월, 한주마다 열리는 HLUG 내부 세미나를 위한 발표자료를 토대로 작성하였다.

목차
I. AWK & SED 역사적 배경 (이 포스트에서 설명)
II. 정규표현식 소개 (이 포스트에서 설명)
III. AWK (이 포스트에서 설명)
IV. AWK Examples(이 포스트에서 설명)
V. SED (다음 포스트에서 설명)
VI. SED Examples(다음 포스트에서 설명)


I. AWK와 SED 배경

AWK 역사적 배경

1977년 Bell Laboratories의 Alfred Aho, Peter Weinberger 그리고 Brian Kernighan이 처음 개발했다. 이 셋의 이름을 따 AWK라 부르고 auk[ɔ́ːk]로 발음한다. 옆에 있는 사진은 바다쇠오리라는 새인데 영어로 auk라 부른다. AWK와 발음이 같기 때문에 AWK 책에 표지모델로 쓰기이기도 했다.
1979년 Version 7 Unix에 처음 배포되었다. V7 Unix는 역사적으로 의미가 있는 유닉스다. 유닉스는 벨연구소에서 PDP-7에 MULTICS를 이식하면서 개발이 시작됐고 1970년 PDP-11에 포팅되면서 UNIX의 첫번째 판이 나왔다. 1973년 Versioin 4 Unix는 C언어로 재작성됐고 1974년 대학에 널리 알려지게 되면서 대학과 벨연구소가 함께 개발하기 시작했다. 그리고 1979년에 V7이 나왔고 여기에 최초로 C 컴파일러와 본셸이 들어갔다. 물론 AWK와 SED도 이 버전에 최초로 포함됐고 make도 이때 포함됐다. 역사적으로 의미가 있다는 이유는, V7이 research unix로서 널리 알려진 유닉스 중 마지막 버전이기 때문이다. 즉, 1980년대  들어서 유닉스가 상업적으로 사용되기 시작했는데, 그 전에 나온 마지막 유산이라는 뜻이다. 물론 V8, V9, V10까지 나오긴 했었지만 V7만큼 알려지진 않았다. 게다가 많은 유닉스 변종들은 V7을 기반으로 했고 그 중 BSD와 SystemV는 또 그 후에 모든 상업적 유닉스의 기반이 됐기 때문에 역사적으로 V7이 중요한 의미를 가진다고 말할 수 있다.


SED 역사적 배경

SED는 Stream EDitor에서 따온 이름이다. 읽을 때는 세드라고 발음한다.  1973년 벨연구소의 Lee E. McMahon이 개발했다. 추측컨대 그 당시의 벨연구소는 지금의 구글보다 더 높은 위상을 가졌을 것 같다. 벨연구소는 전화장비, 물리분야, 네트워크, 소프트웨어 등 첨단 기술의 리더 역할을 했다. 그 연구소에서 완료한 연구 업적으로 7번의 노벨상이 수여됐다고 한다. 하지만 1996년 벨연구소의 전화장비와 물리연구분야가 Lucent Technologies로 독립했고 소수만 남아서 AT&T Bell Laboratories를 이어갔다. 그후 AT&T Laboratories로 존재하다가 2005년에 AT&T Corp.가 통째로 SBC Communications에 인수됐고 SBC Communications는 자신의 이름을 AT&T Inc.로 바꿨다. 그리고 AT&T Corp.의 일부였던 AT&T Laboratories는 SBC Communications의 R&D  부서에 흡수됐고 그 부서 역시 AT&T Labs. Inc 로 자신의 이름을 바꿨다. 예전에 정점을 달리던 AT&T는 사실상 SBC Communications에 흡수되어 사라졌다. 단지 AT&T 이름이 상징적이기 때문에 SBC Communications가 그 이름을 계속 사용하는 것이다.
SED는 AWK와 마찬가지로 1979년 Version 7 Unix에 처음 배포됐다. 그러나 80년대 중반에 perl 등장했고 널리 알려지기 시작하면서 AWK와 SED의 사용 빈도는 급격히 줄었다. 왜냐하면 조금만 길어져도 스크립트가 너무 복잡해지기 때문이다. 그렇기 때문에 복잡한 프로그래밍으로는 거의 사용되지 않고 관용적인 one-liner로써 명맥을 이어가고 있는 실정이다. sed는 ed로 부터 비롯됐고 perl에 영향을 주었다.
*one-liner 라는 단어는 명령행에 한줄로 쓰여져 동작하는 프로그램을 뜻한다.



II. 정규표현식

AWK와 SED는 정규표현식이 적용되지 않아도 작동하지만, 정규표현식을 사용하면 AWK와 SED로 할 수 있는 일이 훨씬 많아진다.

정규표현식이란 텍스트 안에 있는 복잡한 패턴을 표현하는 방법이다. 정규표현식은 정규식으로 줄여서 쓸 수 있고 regular expression은 regex 또는 regexp로 줄여서 쓸 수 있다. 발음하기는 regex가 편하고 레긱스 내지는 레직스라고 읽을 수 있다. 대체 regexp는 어떻게 발음하는지 모르겠다. 아시는 분은 제보 부탁드린다 ;^)

정규표현식은 automata theory와 formal language theory 연구에서 시작됐다. 그리고 최초로 정규표현식을 적용시킨 유틸리티는 Ken Thompson의 QED이다. 또한 나중에 Ken Thompson은 ed에도 정규표현식 기능을 넣었고 이로 인해 정규표현식이 널리 알려지게 됐다. 현재 정규식을 지원하는 유틸리티 중에 가장 유명한 것은 grep일 것이다. grep은 ed에 직접적으로 영향을 받았다. ed 명령어 g/re/p에서 그 이름을 따올 정도였으니까 말이다. 현재 다양한 에디터, 프로그래밍 언어 (특히 스크립팅 언어) 그리고 많은 텍스트 프로세싱 유틸리티들에서 정규표현식이 지원된다.

이 문서에서는 널리 쓰이는 AWK와 SED의 관용구들을 이해할만한 선에서 정규표현식의 일부를 소개한다. 그 선이라는 것은 내 경험을 바탕으로 정한 것이므로 절대 '정규표현식은 이게 전부다'라고 믿지는 말라 :P

누구나 워드 프로세서의 '찾기' 기능을 써본 적 있을 것이다. 정규표현식이 없는 '찾기'는 사용자가 입력한 스트링에 문자 그대로 정확히 매칭되는 단어 또는 문장만 찾을 수 있다. 그런데 정규표현식을 사용하면 '찾기' 기능에 "전체 텍스트 중에서 이러저렇게 생긴 부분을 찾아줘"라고 말할 수 있다. 다시 말하자면, "이 패턴을 가진 부분을 찾아라"라고 명령할 수 있다는 얘기다.

Characters and Character class

abc : abc 캐릭터 그대로
\t   : tab 캐릭터
\n  : newline 캐릭터
[abc] : a or b or c 대괄호는 정규식에서 특수한 의미를 가진다. 대괄호는 캐릭터 클래스를 형성한다. 문자 그대로의 대괄호를 매칭시키고 싶으면 백슬래시를 앞에 두어야 한다. \[ \]
[a-z] : 소문자 a~z 캐릭터 클래스는 범위로 지정할 수도 있다.
[A-Z] : 대문자 A~Z
[0-9] :  숫자 0~9
[a-zA-Z0-9] 다중 범위를 지정할 수도 있다.
[^abc] : abc 제외(반드시 ^이 맨 처음에 나와야함) 캐릭터 클래스에 맨 첫 글자가 ^면 ^이 특별한 의미를 가진다. 캐릭터클래스 안에 있는 캐릭터를 제외한 아무 캐릭터를 뜻한다. 만약 캐릭터 클래스의 맨처음이 아니라 중간에 ^이 들어가면 문자그대로의 ^을 뜻한다.
 .      : 아무 character. 점하나가 아무 캐릭터 하나를 뜻한다. 빈칸도 되고 알파벳, 숫자, 특수기호 등도 가리킨다.


경계(boundary)


^  : 행의 맨 처음
$  : 행의 맨 끝, 그렇기 때문에 ^$은 아무캐릭터가 없는 행 즉, 빈행을 의미한다
\w : 단어. 영숫자를 의미함.
\W:  단어가 아닌 캐릭터. 즉, ~`!@#$%^&*()-+=|\{}[];':"?/<>,. 그리고 공백문자를 뜻한다.
\b: 단어 경계(이질성)
\B: 비 단어 경계(동질성)


이해를 돕기 위해 \b, \B, \w, \W의 예를 들어보겠다.
abcdef:!~ghi-jkl에 대해
 패턴 매칭
(\B\w)* abcdef:!~ghi-jkl
 (\b\w)* abcdef:!~ghi-jkl
 (\b\W)* abcdef:!~ghi-jkl
 (\B.\B)* abcdef:!~ghi-jkl
 (\b.\b)* abcdef:!~ghi-jkl

즉 \B는 자기와 같은 그룹(단어냐 비단어냐)에 속한 녀석에 둘러쳐졌는지 보는 것이고 \b는 자기와 다른 그룹에 속한 녀석에 둘러쳐졌는지 본다.


횟수(quantities)


* : 0번 이상 나옴, 예) a*b  : bbb 매칭
+ : 1번 이상 나옴, 예) a+b  : bbb 매칭 안됨
?  : 0,1번
{n,m} n~m번
{,m} ~m번
{n,} n번이상
{x} x번


캡처링 그룹과 백레퍼런스(capturing groups and back references)

()  패턴을 그룹으로 묶음, 그룹화의 가장 큰 목적은 나중에 특정 그룹을 가리키기 위해서이다.
\n n번째 그룹 가리키는 백레퍼런스
백레퍼런스 지정 순서: 왼쪽 괄호가 등장한 순서대로 해석한다.
((A)(B(C)))  
               \1 : ((A)(B(C)))
   \2: (A) 
   \3: (B(C))
               \4: (C)


백레퍼런스의 키포인트: 백레퍼런스로 가리키는 것은 매칭된 결과 값임을 주의! 패턴을 가리키는 것이 아님!

여기저기서 갖고 온 것들 :P

\  : 인용부호; 특수 캐릭터의 해석을 막음
       예) \^ 행의 처음이라는 의미 상실 
            \\ 알파벳에 특수한 의미를 부여하는 기능(이스케이프 시퀀스) 상실
            \. 아무 캐릭터나 가리킬 수 있는 기능 상실
X|Y : X or Y
\s : 공백문자
\S : 공백문자를 제외한 캐릭터
[\]: \\ 한 것과 의미 동일
[.^]: \. 과 \^ 한 것과 의미 동일



III. AWK

syntax

1. pattern{ action statements }
2. function name(parm list) { statements }

2번은 함수를 정의하는 문법이다. C와는 조금 다른 점은 parm list에 매개변수 뿐만아니라 로컬변수도 써줘야 하는 점이다. 그 점 외에는 특별한 것이 없다.

awk의 프로세싱은 입력 스트림 => awk processing => 출력 스트림이다. 입력 스트림은 파일 또는 표준 입력을 지정할 수 있다. 출력 스트림 역시 파일 또는 표준출력임은 두말하면 잔소리다. 그중 awk processing 부분이 우리가 주목해야할 부분인데 1번에 나온 문법대로 프로그래밍을 해야 한다.
즉 입력스트림을 받아서 pattern에 적용해 보고 패턴에 일치하면 action statements 를 실행하는 것이다. 또한 다수의 pattern{ action }을 체인으로 사용할 수 있다. 1번을 조금 더 C와 비슷한 모양으로 고치면 이렇게 쓸 수도 있다. pattern{ action } 에서 pattern 부분을 생략하고 action의 if 문 안에 패턴을 검사하는 statement를 넣었다.
{
   if (pattern) {
         action statements
   }
}


보다시피 pattern{ action }의 pattern 은 생략가능 하다. 이 경우 모든 입력스트림에 대해 {action}을 수행하게 된다.

그리고 pattern{ action } 에서 { action }도 역시 생략 가능하다! 이 경우 pattern과 일치하는 입력 스트림 부분을 print하는 action이 자동으로 실행한다.


AWK를 배우는데 문법 구조 외에 알아야 할 게 또 있다. 바로 미리 정의된 변수들(pre-defined variables)이다. 이 변수들은 각각 특별한 값을 가지게 되는데 상황에 따라 매번 변하는 변수도 있고 사용자가 변경하지 않는한 계속 그대로인 변수도 있다.

또한 AWK는 일반변수와 배열도 지원한다.

그리고 다양한 표준 함수들도 가지고 있다.

이제 어째서 AWK를 프로그래밍 언어라고 하는지 감이 오지 않는가? 이제 위에 나열한 AWK의 기능들을 설명하겠다. 이 문서는 레퍼런스라기보다는 초보자용 가이드라인이므로 awk의 모든 기능을 설명하는 대신 자주 사용되는 기능들만 설명한다.


pre-defined variables

미리 정의된 변수들이 있다. built-in variables 라고 부르기도 한다. 이 변수들을 이해하기 위한 몇가지 개념을 먼저 소개하겠다. record나 field는 awk의 입력으로 들어온 전체 텍스트 중 일부다. 전체 텍스트가 awk를 거치는 모습은 간단히 이렇게 그릴 수 있을 것이다.
Input ==> awk processing ==> output
input 은 표준입력이 될 수도 있고 평범한 파일일 수도 있는데 awk는 작업을 처리하기 위해서 input을 통째로 작업대 위에 올려놓지 않고 부분부분 잘라서 올려놓는데 이 때 작업대 위로 올려놓은 게 레코드다. 그리고 그 레코드는 또 필드로 이루어져 있다.


이제 '변수이름: 의미' 형식으로 미리정의된 변수들의 의미를 중요한 것만 알아보겠다.

RS: record separator (디폴트는 개행문자)
FS: field separator (디폴트는 공백문자)
NF: the number of fields (FS로 나뉜 한 레코드 안의 필드 개수)
ORS: output record separator(디폴트는 개행문자)
NR: total number of record so far(현재 라인 번호)
ARGC, ARGV: 매개변수의 개수와 매개변수를 가리키는 변수
FNR: number of record in the current input file
OFS: ouput field separator(디폴트는 공백문자)
FILENAME: name of input file
SUBSEP: separate multiple subscripts in array elements(,; \034; \0x1C)
IGNORECASE: 값이 0이 아니면 패턴 매칭에 대소문자 구별 안 함


RS는 awk가 전체 텍스트 중 작업대 위로 레코드를 올릴 때 어떤 단위로 올릴지 정하는 변수라 할 수 있겠다. 디폴트 값은 newline 캐릭터이므로 이 때 awk는 grep이나 sed처럼 한 줄 씩 끊어서 작업한다고 말할 수 있다.
FS는 레코드 내의 필드들의 구분자이다. 기본 값은 공백이므로 어떤 레코드의 내용이 abc def ghi jkl 이면 1번 필드($1)는 abc,2번($2)은 def 이런 식이다. 그리고 $0은 abc def ghi jkl 이다. 즉 현재 레코드의 전체 부분을 가리킨다.
awk의 매개변수에 파일을 여러개 지정했다면 FNR과 NR의 차이점도 알아야 한다. FNR은 지금 awk가 작업하고 있는 파일 내에서 몇번째 레코드인지 가리키고 NR은 파일 구분 없이 맨처음부터 지금까지 총 몇번째 레코드인지 가리킨다.
SUBSEP은 배열 사용시 필요한 내용인데, 배열을 설명할 때 부가 설명드리겠다.

시험삼아 위에 설명한 내장 변수들을 사용한 몇가지 간단한 관용구처럼 사용되는 one liner들을 따져보자.

1. awk 'NR%2==0{ print $0 }'
2. awk 'NR%2'
3. awk '0'
4. awk '”0”'
5. awk 'NR>5&&NR<10'
6. awk '$0 = NR" "$0'

1번은 짝수 줄NR%2==0이면 출력하라{ print $0 }는 뜻이다. 2번은 홀수 줄이면 출력하라는 뜻이다. 왜냐하면 NR이 홀수 줄이면 NR%2 가 0이 아니므로 디폴트 액션인 { print $0 }이 출력되기 때문이다. 여기서 NR%2의 값은 0또는 1인데 0은 false를 뜻하고 0이 아닌 숫자는 true를 뜻한다. 3번은 아무 줄도 출력하지 않는다. 왜냐하면 항상 0, false이기 때문이다. 4번은 항상 출력한다. "0"은 문자열이기 때문에 항상 참이다. 5번은 6,7,8,9 줄을 출력한다. 6번은 줄앞에 줄번호를 붙인다. $0은 현재 레코드인데 $0 = NR" "$0 은 $0에 NR" "$0을 대입하라는 의미이다. 중간에 " " 은 단지 줄번호(NR)과 레코드($0) 사이에 공간을 두기 위해 붙인 문자열에 지나지 않는다.

변수와 배열

변수는 숫자거나 스트링일 수 있다. awk의 변수와 배열은 따로 초기화하거나 타입을 지정할 필요가 없으며 필요시 자동으로 형변환이 된다. 즉 사칙연산이 필요할 때는 숫자였다가 문자열 이어붙이기를 할 때는 스트링이 되기도 한다.

초기화가 필요 없으므로 곧바로 a++; 이렇게 쓸 수도 있다. 이때 a의 값은 1이 된다. 왜냐하면 초기화하지 않은 변수의 값은 숫자의 경우 0이기 때문이다. 그리고 변수에 octal 과 hexadecimal 값을 넣을 수 있다.  a=0nn;, b=0xnn; 이렇게 사용하면 된다.

변수에 스트링을 대입하는 방법은 a="string" 이런 식이다. 또한 스트링 안에 이스케이프 시퀀스도 사용할 수 있다. 몇가지 이스케이프 시퀀스의 예는 다음과 같다.
\\: 백슬래시 캐릭터 그대로. 백슬래시는 이스케이프 시퀀스를 만들 때 사용되므로 문자 그대로의 백슬래시를 써야할 때는 백슬래시를 두개붙여쓴다.
\a: ASCII의 BEL 캐릭터
\b: 백스페이스 캐릭터
\n: 개행문자
\r: 캐리지 리턴
\t: 수평 탭
\v: 수직 탭
\ddd: octal value로 표현되는 캐릭터. 0-7까지의 숫자만 이용해서 캐릭터를 표현하며 범위 밖의 숫자 또는 문자는 이스케이프 시퀀스에 해당하지 않는다. 즉 그 앞 부분까지만 octal value로 표현되는 이스케이프 시퀀스다. 예를들어 "\438"은 #8이다.
\xnnn: hexadecimal value로 표현되는 캐릭터. 역시 \x 뒤를 따르는 모든 16진수 숫자들을 이스케이프시퀀스로 받아들이고 범위를 벗어나면 그냥 문자그대로로 인식한다. 예를들어 "\x23G"는 #G이다.


배열도 변수와 마찬가지로 초기화가 필요하지 않다. 다짜고짜 a[0]++; 이런 식으로 쓸 수 있다. 그리고 특이하면서 유용하게 사용되는 특징은 배열의 인덱스에 스트링을 넣을 수 있다는 점이다. 그리고 숫자로는 음수나 소수를 넣을 수 있다. 예를 들어
a["Foundations of AWK"]=1; 이렇게 쓰거나 a[-12.07]++; 이렇게 쓸 수도 있다. 또한 awk의 배열은 다차원 배열을 흉내낼 수 있는데 다음과 같이 쓸 수 있다. 
a["Foundations of AWK","Junyeong"]="Jeong";
a["Foundations of AWK","Alfred"]="Aho";
a[0,1,0]="Kernighan";
i=0; j=1; k=1;
a[i,j,k]="Weinberger";

즉 배열의 섭스크립트를 여러 문자열이나 숫자의 조합 또는 변수의 조합으로 사용할 수 있으며 조합시에 , 를 사용하는데 이것은 아까 pre-defined 변수에서 SUBSEP 변수의 값인 캐릭터이다. 이 캐릭터가 눈에 잘 띄지 않는다면 SUBSEP변수를 바꿔서 다른 캐릭터로 변경해도 되고 캐릭터를 octal 이나 hexadecimal 값으로 기입해도 상관없다. 즉 위의 예를
a["Foundations of AWK\034Junyeong"]="Jeong";
a["Foundations of AWK\034Alfred"]="Aho";
이렇게 쓸 수 있다는 말이다. 물론 a["Foundations of AWK","Junyeong"]="Jeong"; 으로 값을 할당하고 a["Foundations of AWK\034Junyeong"] 으로 값을 가져오는 것도 당연 가능하다. 단지 "," 캐릭터를 스트링의 이스케이프 시퀀스로 표현했을 뿐이기 때문이다.

그리고 배열의 특정 섭스크립트를 검색하는 연산자로서 in 이 있다. 사용법은 subscript in array이다. 만약 위의 예를 적용하면
if ("Foundations of AWK\034Junyeong" in a) print a["Foundations of AWK\034Junyeong");
이다. 혹은 if (("Foundations of AWK","Junyeong") in a) print a["Foundations of AWK","Junyeong"]; 도 똑같다.



패턴

AWK의 syntax, awk 'pattern{ action statements }' 중에서 pattern 부분을 작성하는 방법은 다음과 같다.

BEGIN{ }: 모든 인풋보다 먼저 실행되는 statements를 지정, 즉 awk의 작업대에 첫 레코드가 올라가기 전에 실행되는 statement들의 블록을 지정하는 셈이다. 초기화 작업을 하는 곳이라고 생각하면 된다. BEGIN 패턴은 한 awk 명령에 여러번 나올 수 있는데 모든 BEGIN블록은 한데 모아진다.
END{}: 더 이상 인풋이 없을 때 실행되는 statements지정. 역시 END블록은 여러번 나올 수 있고 하나의 END블록으로 모아진다.
/정규식/: / / 로 묶어서 정규식을 사용할 수 있다.
패턴1 && 패턴2: AND 논리 연산, 물론 패턴이라는 말은 /정규식/도 내포한다.
패턴1 || 패턴2: OR 논리 연산
!패턴: NOT 논리 연산,
패턴1, 패턴2: range pattern인데 패턴1인 레코드로부터 패턴2인 레코드까지인 범위를 지정한다.



연산자들

기본적으로 C에서 사용할 수 있는 연산자들(포인터나 구조체 관련한 연산자 제외)을 사용가능하다. 거기에 덧붙여 AWK에서 사용되는 특별한 연산자들이 있으니 그것만 여기 소개하겠다.
$: field reference, 레코드에서 FS로 구분되는 필드를 가리킨다. 특별히 $0은 모든 필드들을 뜻한다.
space: 공백 연산자는 스트링과 스트링을 붙이는데 사용한다.
|, |&: getline, print, printf에 사용되는 piped I/O
~, !~: 정규표현식 매치, 비매치. 정규식을 연산자의 오른쪽에 써야만 한다.
in: 배열에서 특정 섭스크립트 검색

제어문

C에서 사용하는 제어문과 비슷하다. AWK는 C를 많이 따랐기 때문에 비슷한 것은 당연하다. 다만 배열에 관련해서 delete문이 있고 switch문은 없는데, switch 문은 awk의 옵션으로 --enable-switch로써 사용가능하다.
if (condition) statement [ else statement ]
while (condition) statement
do statement while (condition)
for (expr1; expr2; expr3) statement
for (var in array) statement
break
continue
delete array[index]
delete array
exit [ expression ]
{statements }


I/O 문

I/O statements는 여러 종류가 있지만 그중 자주 사용되는 getline과 print, printf만 알아보겠다. 다른 종류(close, system, fflush, next, nextfile) 대해서는 맨페이지를 참고하시라 ;^)

getline: 다음 레코드를 $0로 설정함
getline < "file": 다음 레코드를 "파일"에서 가져온다
getline var: 다음 레코드를 변수 var에 넣는다
getline var < "file": 다음 레코드를 "파일"에서 가져와서 변수 var에 넣음
"command" | getline [var]: "command"를 실행하여 표준출력을 파이프로 넘기고 넘어온 입력을 getline이 $0 [또는 변수var]으로 설정한다
"command" |& getline [var]: "command"를 co-process로 실행시켜 표준출력을 파이프로 넘이고 getline은 넘어온 입력을 $0 [또는 변수var]로 설정한다
print: 현재 레코드를 출력한다. 출력된 레코드는 ORS가 맨 끝에 붙음
print expr-list: 표현식을 출력한다. 각 표현식은 OFS로 구분되어 출력된다. 예를 들어 print $1, $2;
print expr-list > "file": 표현식을 "file"로 출력한다
print expr-list >> "file": 표현식을 "file" 끝에 덧붙인다
print expr-list | "command": 표준출력을 파이프에 쓰고 "command"에서 그 파이프를 표준입력으로 받는다
print expr-list |& "command": print 표준출력을 파이프에 쓰고 "command"는 co-process로 실행돼 파이프에서 표준입력을 읽는다
printf format, expr-list: C의 printf처럼 포맷을 지정해서 표현식을 출력한다(포맷은 C와 유사하며 자세한 내용은 awk맨페이지를 참고하시라)
printf format, expr-list > "file": 포맷을 지정해서 표현식을 파일로 출력한다.

위의 설명들은 쭉 읽어보면 아마 하나 빼고 바로바로 이해가 될 내용일 것이다. 그 하나는 바로 co-process 를 실행시킨다는 |& 연산자를 사용한 부분일 것이다.
"command" | getline 이나 print | "command" 중 전자는 각각 "command"의 표준출력을 getline의 표준입력으로 보낸 것이고, 후자는 print의 표준출력을 "command"의 표준입력으로 보낸 것이다. 둘 다 일방통행이라는 공통점이 있다. 그런데 |& 연산자를 사용할 시에는 "command"를 co-process(awk와 어깨를 나란히 하고 같이 뛰는 프로세스)로 실행시키게 된다. 그러므로 양방향 통신이 가능한데, 무슨 뜻이냐하면 print |& "command1"; "command1" |& getline 처럼 사용해서 print로써 명령으로 입력을 보내고 getline으로 결과를 받아본다는 뜻이다. 당연히 양쪽에 기입된 "command1"은 서로 같아야 출력을 올바로 볼 수 있다. 실제 예를 보면 확실히 이해가 될 것이다.
to_upper 배시 셸 스크립트
#!/bin/bash
#set -x
while read arg
do
    echo "$arg" | tr '[a-z]' '[A-Z]'
done

g6라는 awk 스크립트
{
  print $0 |& "./to_upper"
  "./to_upper" |& getline hold
  print hold
}

이제 이 awk 스크립트를 명령행에서 이렇게 실행시킨다
$ awk -f g6 < SOMEFILE

결과는 SOMEFILE 안에 있는 모든 영소문자들이 영대문자로 치환되어 출력된다. 만약 g6의 |&대신 |을 사용한다면 의도한대로 실행되지 않을 것이다. 비록 첫번째 statement는 ./to_upper로 print의 출력을 입력시킬 순 있지만 두번째 statement의 ./to_upper 프로세스는 첫번째 statement에서 돌아간 ./to_upper의 프로세스랑 다른 것이므로 원하는 결과는 얻을 수 없다!

I/O문에서 사용하는 특별한 파일들

리다이렉션을 이용해 파일로 print, printf 의 결과를 출력하거나 getline으로 파일에서 입력을 받을 수 있는데, 몇몇 파일이름들은 이미 awk가 특별한 의미를 부여해 놓았으므로 파일시스템 상의 파일을 의미하진 않는다.

/dev/stdin: 표준입력
/dev/stdout: 표준출력
/dev/stderr: 표준에러
/dev/fd/n: n번 파일디스크립터
/inet/tcp/lport/rhost/rport: TCP/IP 커넥션. 로컬의 포트는 lport, 원격호스트는 rhost, 원격포트는 rport. lport를 0으로 지정하면 운영체제가 알아서 선택한다.
/inet/udp/lport/rhost/rport: UDP/IP 커넥션. TCP/IP 와 사용법 같다.

그리고 현재 실행 중인 awk 프로세스에 대한 정보를 얻기위해
/dev/pid, /dev/ppid, /dev/pgrid, /dev/user 를 사용할 수 있다. gawk에서는 이 파일들 대신 미리정의된 변수인 PROCINFO 배열을 사용한다. PROCINFO에서 사용되는 섭스크립트는 다음과 같다. "FS", "egid", "euid", "gid", "group1", "group2", "pgrpid", "pid", "ppid", "uid", "version"


AWK가 제공하는 표준 함수들

표준함수에 대한 내용은 이문서에 설명하지 않겠다. 함수에 대한 설명이 맨페이지에 일목요연하게 나와있기 때문이다. 다만, 표준함수들에 대한 분류만 보기 좋게 써보겠다.
Numeric functions
String functions
Time functions
Bit Manipulation functions
Internationalization functions(since gawk 3.1)

뭐니뭐니해도 스트링 함수들이 가장 자주 사용되므로 거기에 있는 유용한 함수들은 잘 알아두는 게 좋다.


사용자 정의 함수

맨처음 syntax 섹션에서 function name(parm list) { statements }라고 적어놓은 것을 기억할 것이다. 이게 함수를 정의하는 방식이다. 특이한 점은 parm list 에 로컬 변수도 적어줘야 하는 점이다. 그리고 함수이름 name과 왼쪽 괄호 ( 는 떨어져서 안 된다. 예를 들어
function test(p, q,          i, j) {
      statements
}
p,q 는 함수를 호출 시 넘겨야하는 파라미터고 i,j 는 statements에서 사용되는 로컬 변수이다. 관습적으로 파라미터와 로컬변수 사이는 널찍하게 스페이스를 둔다.


awk 옵션들

커맨드라인에서 awk를 실행시킬 때 유용하게 쓸 수 있는 옵션 몇가지를 추려보았다.
-F fs: FS의 값을 지정한다. BEGIN{ FS="fs" } 이렇게 한 것과 같다.
-v var=val: 변수 var를 val로 지정한다. BEGIN{var=val} 한 것과 같다
-f file: awk 스크립트를 지정한다
--dump-variables[=file]: global 변수들의 이름과 값을 출력한다. file을 지정하지 않으면 현재 디렉터리의 awkvars.out 파일로 출력한다. 디버깅용으로 사용할 수 있다.
--re-interval: 정규표현식 중 인터벌을 사용할 수 있게 한다. {n,m}



IV. AWK Examples

앞에서 이론 공부를 했으니 이제 몇가지 예제를 보면서 익히는 게 좋을 것 같다. 우아한 것들로 골라봤다.

1. awk '$7 ~ /^[a-f]/'
7번 필드가 정규식 /^[a-f]/에 매칭된다면 출력한다.

2. awk '$7 !~ /^[^a-f]/{ print > “/proc/self/fd/2” }'
바로 앞의 예와 같은 패턴 매칭이지만 출력을 표준에러로 한다. "/dev/stderr" 를 대신 쓸 수 있다.

3. awk 'NF'
NF가 0(false)이 아니면 출력한다. 즉 빈행이 아니면 출력한다. 여기서 action statements는 생략됐으므로 디폴트인 { print $0 }가 실행됨은 이제 다들 아실거라 생각한다.

4. awk 'NF{ $0=cnt++" "$0}1'
NF가 0이 아니면 줄 앞에 cnt를 표시한 뒤 출력한다. 1이라는 숫자에는 의미가 없다. 단지 패턴에 0이 아닌 다른 숫자나 스트링이 오면 항상 true 이기 때문에 디폴트 액션이 실행된다.

5. awk '{ sub(/^[ \t]*/,""); print }'
표준 스트링 함수인 sub(pattern,replacement) 를 사용했다. 모든 패턴에 대해서 sub(/^[ \t]*/,"") 를 적용하며 이 함수는 레코드 자체를 수정하므로 리턴값을 받을 필요는 없다. 함수 의미를 풀면 정규식 ^[ \t]* 를 지우라는 뜻이다. 즉, leading 공백문자들을 삭제한다.

6. awk '{ gsub(/^[ \t]*|[ \t]*$/,"") }1'
이것은 앞선 예와 비슷한 기능이다. gsub() 함수는 sub의 global버전이라 할 수 있겠다. sub은 최초 매치만 substitution을 행함에 반해 gsub은 모든 매치들에 대해 substitution을 수행한다. 위 one-liner의 뜻은 모든 leading whitespace 캐릭터들 (^[ \t]*) 또는 (|) 모든 trailing whitespace 캐릭터들 ([ \t]*$)을 제거하라는 뜻이다. 그리고 맨 마지막에 1을 붙여서 디폴트 액션을 수행하게끔 하였다.

7. awk '!a[$0]++'
이것은 배열의 섭스크립트에 스트링도 넣을 수 있다는 점과 awk에서 변수나 배열은 초기화가 필요하지 않다는 점을 십분활용한 예다.
만약 현재 레코드가 처음 나온 레코드라면(현재 라인이 앞선 라인들과 중복되지 않은 라인이면) a[$0]의 값은 0이다. 그러므로 !a[$0]은 0이 아니다. true다. 패턴이 true이므로 디폴트 액션문이 실행되는 조건을 만족시킨다. 그러고 나서 a[$0]을 1 증가시켜서 (a[$0]++) 값이 1이 된다. 만약 나중에 똑같은 레코드가 들어왔다면, !a[$0]은 false가 돼서 출력은 되지 않을 것이다. 그래도 a[$0]++은 실행되므로 값이 증가된다. 결론적으로 이 one-liner의 역할은 중복된 라인을 제거하면서 똑같은 라인의 개수를 파악하는 것이다.

8. awk 'BEGIN{FS=""}{ for (i=NF;i>=1;i--) printf "%s",$i; print ""}'
우선 인풋이 들어오기 전에 BEGIN{} 블록을 실행한다. FS를 널스트링으로 바꿨다. FS 의 값 설정은 awk -F"" 로써 편리하게 할 수도 있다. FS가 널스트링이면 한개의 필드는 한개의 캐릭터에 대응된다. for 문에서 사용한 NF는 필드의 개수를 뜻하므로 i=NF는 마지막 필드를 가리키는 셈이다. for문을 돌면서 현재 i가 가리키는 필드를 printf문으로 출력한다. 즉 맨마지막 캐릭터부터 맨앞 캐릭터까지 역순으로 출력한다. 마지막 print "" 는 단지, 마지막에 ORS를 붙여주기 위함이다.

9. cat /usr/man/man1/awk.1 |grep '\(^\.SH\|^\.SS\)'|awk '/\.SS/{ $0 = "    "$0}{sub(".SH",""); sub(".SS", "")}1'
awk 맨페이지를 cat으로 읽은 뒤 타이틀을 뜻하는 .SH와 .SS 라인만 추려내 그 라인을 보기 좋도록 .SH와 .SS를 떼어내는 one-liner이다. 즉 맨페이지의 목차를 보여준다. 만약 맨페이지가 gzip 압축됐다면 cat 명령어를 gzip -cd 로 대체하면 된다.

10. awk 'NR==40001,NR==40100{ array[$3]++};END{ size=asorti(array,dest); for (i=1; i <= size; i++) {print dest[i], array[dest[i]]}}' /var/log/messages
messages 파일 중 40001번째 줄부터 40100번째 줄까지 읽고 세번째 필드의 출현 횟수를 기록한다. messages의 세번째 필드는 시각이다. 그러고 나서 모든 인풋이 소진되면 END블록이 실행된다. asorti 는 표준 스트링함수인데 array배열을 받아서 배열의 값대로 정렬한 뒤 결과를 dest 배열의 값에 넣고 인덱스는 1번부터 시작해 증가시킨다. 즉 dest배열은 시간순으로 정렬된 셈이다. 그리고 마지막 for문에 print dest[i], array[dest[i]] 로써 "시간  출현횟수" 형식으로 출력한다.

11.  awk 'END{ print NR}'
모든 인풋이 소진되고 END블록이 실행된다. NR의 값은 마지막 줄번호를 가리키므로 총 라인 수를 출력하는 셈이다.

12. awk 'BEGIN{ mysql="mysql -u rhdxmr --password=somepassword mydb" } { string1="\047Jaco Pastorius\047"; string2="\047Cha Cha\047"; print "insert into test values("string1","string2");"|mysql}'

이 예에서는 print I/O statement의 표준출력을 | 연산자로써 외부 프로그램의 표준입력에 주었다는 것이 주목할 점이다. 명령행에서 작은 따옴표를 넣으면 의도와 다르게 배시에서 파싱돼버리므로 octal value인 \047로 작은 따옴표를 표현했다. 그래서 MySQL에 입력된 쿼리문은 insert into test values('Jaco Pastorius','Cha Cha');다. 이 예에서 처럼 쿼리문의 일부를 변수로 대체시켜 상황에 따라서 다른 쿼리문을 생성할 수 있다.

13. awk 'length < 86'
length는 변수처럼 보이지만 원래는 표준 함수 length()이다. awk에서 유일하게 변수형태와 함수형태 모두 사용가능한 녀석이다. 이것은 어디까지 historical feature이므로 깊게 생각할 필요는 없다. length 는 length($0)와 같은 의미인데 이 one-liner는 한 레코드의 전체 길이가 86이하인 짧은 줄만 출력하라는 뜻이 된다.

14. awk '{ print $NF }'
NF는 현재 레코드의 총 필드의 개수를 의미하는데 이는 곧 마지막 필드가 몇번째 필드인지 가리킨다. 그러므로 print $NF는 마지막 필드를 출력하라는 의미이다.

15. awk '{  for(i=1; i<=NF; i++) A = A" "$i; print A; A = "" }'
i의 초기값으로 지정된 필드부터 마지막 필드까지 출력한다. for문의 i값에 처음 출력을 원하는 필드번호를 적으면 그 필드부터 마지막 필드까지 출력한다.

여기까지 먼길을 왔는데 AWK에 대한 설명은 이쯤에서 마치도록 하겠다. 조금 쉬었다 바로 SED가 무언지 보러 갈테니 아직 긴장을 풀지 마시길. 낄낄


출처 : http://rhdxmr.tistory.com/57
반응형

'OS > Linux' 카테고리의 다른 글

CENTOS 7에 XRDP 설치하기  (0) 2017.08.26
리눅스 백업 및 복구  (0) 2013.01.25
삼성 컴퓨터 유분투 설치기.  (0) 2012.02.06
rkhunter (리눅스 침입 탐지 사용하기)  (1) 2010.10.14
ps auxc 와 ps aux 결과 비교하기  (0) 2010.01.21
반응형

지원 OS : Win32 & Linux

개발환경 : Javascript

사용제한 : 없음

제작자 : outmind@cafen.net

자료설명 :
 
* 플레쉬 차트 (Open Flash Chart2 with JS)
*
* @author Kimjonggab outmind@cafen.net
* @copyright Copyright (c) 2004 Cafen.net (http://cafen.net)
* @license http://opensource..org/licenses/gpl-license.php GNU General Public License (GPL)
 

* 참조 URL 1 : http://openapi2.cafen.net
* 참조 URL 2 : http://service2.cafen.net/example/chart2.html
* 참조 URL 3 : http://teethgrinder.co.uk/open-flash-chart-2/
 
* 적용 방법 (플레쉬 차트)
<script>var cafenGlobalConf = {scripturl : 'http://service2.cafen.net/'}</script>
<script type="text/javascript" src="http://service2.cafen.net/cafenOFC2JS.js" charset=utf-8></script>
<table class='sampeChart' title='Line Chart' title_style='font-size:14px' y_legend='1/100' x_legend='Month' border=0 width=800 height=400 bgcolor=#f5f5f5  wmode='transparent' >
    <tbody>
        <tr type='xy_axis' colour=#8c8c8c grid_colour=#d5d5d5  stroke=2 min=0 max=25 step=4 rotate=45 size='12' font_colour='#000000'>
            <td></td>
            <td>Jan</td>
            <td>Feb</td>
            <td>Mar</td>
            <td>Apr</td>
            <td>May</td>
            <td>Jun</td>
            <td>Aug</td>
            <td>Sep</td>
        </tr>
        <tr type='line' colour=#5aa775 stroke=2 line='dotted' pointer='star' pointersize=10 tooltip="Visitor of #x_label#(#val#)  ">
            <td>Visitor</td>
            <td>20</td>
            <td>17</td>
            <td>18</td>
            <td>9</td>
            <td>20</td>
            <td>17</td>
            <td>18</td>
            <td>9</td>
        </tr>
    </tbody>
</table>
 
<script>
onload = function() { 
    var ofc2js = new cafenOFC2JS(); 
    ofc2js.renderElementsByClassName('sampeChart'); 

</script>   

기타 문제점을 발견하신분은 outmind@cafen.net 으로 연락 주시기 바랍니다.




출처 : http://phpschool.com/gnuboard4/bbs/board.php?bo_table=download&wr_id=16362&page=2
반응형

'Language > PHP' 카테고리의 다른 글

정규표현식 테스트 필요할 때 보조 프로그램  (0) 2010.01.19
PHP 정규표현식  (0) 2010.01.18
eclipse 설정: Xdebug로 디버깅하기 with XAMPP 서버  (2) 2009.12.28
XAMPP 설치 가이드  (0) 2009.12.28
xampp  (0) 2009.12.28
반응형

지원 OS : windows 계열

개발환경 : 델파이

사용제한 : 프리웨어

제작자 : 김기수 ( kikisu@kikisu.com)

자료설명 :

Php, c#, 자바, 자바스크립트 이것저것 하다보니 정규표현식 쓸일이 많아 제작하게 되었습니다.

기존에 외국 프로그램으로 테스트 하던중 컴텨가 포맷되어 잘쓰던 프로그램이 날았더군요

다시 외국사이트 갔는데 프로그램명을 몰라 찾는데 실패하여 그냥 제 입맛대로 델파이로
하나 맹글었습니다.  Exe 파일 다운받아 바로 실행하면 됩니다.
저는 6개월동안 고놈 잘써먹고 있는데 도움이 될지는 모르겠습니다.

정규표현식중 기본적으로 자주 쓰는 것은 이곳저곳에서 주워담아서 넣어놨습니다.
삭제는 파일만 삭제하면 되므로 쓰실분은 잘 쓰세요

출처 : http://phpschool.com/gnuboard4/bbs/board.php?bo_table=download&wr_id=16604&page=1


이클립스 사용하시면 관련 plug-in이 있습니다.
QuickREx
Regex Uti

http://www.gskinner.com/RegExr/ 여기도 강추 입니다~~

http://www.editpadpro.com/ 이것도 강추합니다... l
반응형

'Language > PHP' 카테고리의 다른 글

플레쉬 차트 (OFC2JS) - Table2Chart  (0) 2010.01.19
PHP 정규표현식  (0) 2010.01.18
eclipse 설정: Xdebug로 디버깅하기 with XAMPP 서버  (2) 2009.12.28
XAMPP 설치 가이드  (0) 2009.12.28
xampp  (0) 2009.12.28
반응형
반응형

'보안' 카테고리의 다른 글

시큐어 코딩 점검 툴  (0) 2013.05.10
해커그룹 어노니머스, 해킹 전용 OS 공개  (0) 2012.03.16
웹 어플리케이션 보안 가이드 2010  (0) 2012.01.11
[G-PIN] 공공아이핀 설치하기  (0) 2011.08.09
보안 관련 사이트  (0) 2010.11.05

+ Recent posts