vi 녹화 실행

linux 2012. 6. 15. 17:58

 

vi 녹화, macro 저장

 

http://kldp.org/node/116961

정말 자주(?) 반복하셔야 하면 q로 녹화하시고 @로 반복하신 후 @@로 재반복하시는 수가 있습니다.

예:
q x ctrl-w j q (x에 녹화. 편의 상 스폐이스로 분리했지만 스페이스 없이 이 순서대로 입력하셔야 합니다.)

@x (x 내용을 실행)

@@ (재실행)

 

Posted by 언제나19
l

vi sed 개행문자

mac 2012. 6. 14. 19:13

 

mac terminal vi에서

줄바꿈으로 바꾸려고,

:s/\" /\n/g

를 했는데, 안되네.

 

:s/\" /\r/g

는 되네. 왜 그렇지..

 

mac, bsd에서는 \n을 쓰는 것 아니었나?

 

http://www.grymoire.com/Unix/Sed.html#uh-nl

However, if you are inserting a new line, don't use "\n" - instead insert a literal new line character:

(echo a;echo x;echo y) | sed 's:x:X\
:'

generates

a
X

y

 

Adding more than one line

All three commands will allow you to add more than one line. Just end each line with a "\:"

#!/bin/sh
sed '
/WORD/ a\
Add this line\
This line\
And this line

 

 

Posted by 언제나19
l

Enum type data를 그대로 assign해도 되는지 찾고 싶었는데, 못찾았네.

되겄지..


http://javarevisited.blogspot.jp/2011/08/enum-in-java-example-tutorial.html

6) Since constants defined inside enum in java are final you can safely compare them using "==" equality operator as shwon in following example of   java enum:

Currency usCoin = Currency.DIME;
    if(usCoin == Currency.DIME){
       System.out.println("enum in java can be"+
               "compared using ==");
    }


Read more: http://javarevisited.blogspot.com/2011/08/enum-in-java-example-tutorial.html#ixzz1vgXHc0fM



http://blog.deepincode.com/2006/11/type-safe-enumerations-in-java-50/

Java 5 enum

enums provide default implementation for toString(), equals(), hashCode() methods (Umm.. no extra work)


enums cannot be cloned



Posted by 언제나19
l