[PHP] explode

프로그램 2013.04.16 16:14


root@svn ~/php [0.07 0.02]> cat explode.php 
<?

$pizza = "p1 p2 p3";
$pieces = explode(" ",$pizza);
print_r($pieces);
?>
16:07:56
root@svn ~/php [0.07 0.02]> php explode.php 
Array
(
    [0] => p1
    [1] => p2
    [2] => p3
)



root@svn ~/php [0.07 0.02]> cat explode1.php 
<?
$data = "smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin";
list($user,$pass,$uid,$gid,$gecos,$home,$shell) = explode(":",$data);

echo $user.",".$home.",".$shell;
?>
16:10:46
root@svn ~/php [0.07 0.02]> php explode1.php 
smmsp,/var/spool/mqueue,/sbin/nologin



신고

'프로그램' 카테고리의 다른 글

ip 정규표현식  (0) 2013.04.24
0  (0) 2013.04.16
[PHP] explode  (0) 2013.04.16
[php] fopen 사용예시  (0) 2013.04.12
[PHP] 하드 용량 자동 변환 하기  (0) 2013.04.11
클라이언트 os와 브라우저 알아내기  (0) 2013.04.05

WRITTEN BY
김병국
유용했던 자료를 기록해 두었습니다. 도움이 되시길~~~ Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you fun

받은 트랙백이 없고 , 댓글이 없습니다.
secret

deb http://archive.debian.org/debian/ etch main non-free contrib
deb-src http://archive.debian.org/debian/ etch main non-free contrib

deb http://archive.debian.org/debian-security/ etch/updates main non-free contrib
deb-src http://archive.debian.org/debian-security/ etch/updates main non-free contrib

저작자 표시 비영리 동일 조건 변경 허락
신고

'서버관리' 카테고리의 다른 글

제목을 입력해 주세요.  (0) 2012.11.27
id: cannot find name for user ID  (0) 2012.11.27
debian4 sources.list  (0) 2012.11.27
debian4 설치  (0) 2012.11.27
데비안 cd image 다운로드  (0) 2012.11.26
-로 시작하는 파일 잘 못 생성시 삭제  (0) 2012.11.26

WRITTEN BY
김병국
유용했던 자료를 기록해 두었습니다. 도움이 되시길~~~ Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you fun

받은 트랙백이 없고 , 댓글이 없습니다.
secret
Argument list too long

해당 디렉토리로 가서 아래 스크립트 실행

for file in $(ls)
do
    rm -fv $file
done


안써먹으니 이 간단한것도 기억에서 잊혀진다.


# find ./ -name "*.log" -print0 
./1.log./2.log

 

# find ./ -name "*.log" -print0 | xargs -0 rm -f
# ls

다 지워 졌음.

 

 

find 옵션

-print0
True; print the full file name on the standard output, followed by a null
character (instead of the newline character that '-print' uses). This
allows file names that contain newlines or other types of white space to be
correctly interpreted by programs that process the find output. This option
corresponds to the '-0' option of xargs.

 

 

xargs 옵션

--null, -0

Input items are terminated by a null character instead of by whitespace, and
the quotes and backslash are not special (every character is taken liter-
ally). Disables the end of file string, which is treated like any other
argument. Useful when input items might contain white space, quote marks,
or backslashes. The GNU find -print0 option produces input suitable for
this mode.

신고

WRITTEN BY
김병국
유용했던 자료를 기록해 두었습니다. 도움이 되시길~~~ Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you fun

받은 트랙백이 없고 , 댓글이 없습니다.
secret