cat employees.txt

byoungguk:100:server
gildong:200:sales


cat read-employees.sh

#!/bin/sh
IFS=:
echo "employee names:"
echo "---------------"
while read name empid dept
do
     echo "$name is part of $dept department"
done < ~/employees.txt




./read-employees.sh
employee names:
---------------
byoungguk is part of server department
gildong is part of sales department






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

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

[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

cat /proc/scsi/scsi

Attached devices:
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: ATA      Model: INTEL SSDSA2CW08 Rev: 0302
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi0 Channel: 00 Id: 02 Lun: 00
  Vendor: SEAGATE  Model: ST373455SS       Rev: 0002
  Type:   Direct-Access                    ANSI SCSI revision: 05

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

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

bash 에서 랜덤수 생성  (0) 2012.12.17
ip_conntrack: table full, dropping packet. [ok]  (2) 2012.12.15
하드 모델명 확인  (0) 2012.12.14
불법 접근 차단하기  (0) 2012.12.13
Adaptec Raid Controller Build options  (0) 2012.12.13
취약한 cgi 프로그램 perl 예시  (0) 2012.12.13

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

root@www ~ [0.00 0.09]> cat /etc/passwd | awk -F: '{print " id: "$1"      "" directory : "$6}'
id: root       directory : /root
id: bin       directory : /bin
id: daemon       directory : /sbin
...중략

     -F fs               --field-separator=fs

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

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

ps 명령시 STAT설명  (0) 2012.12.07
whowatch 사용  (0) 2012.12.07
id, 홈디렉토리 리스트 만들기  (0) 2012.12.07
열려 있는 포트 확인하기  (0) 2012.12.06
유저생성시 디폴트값을 볼려면?  (0) 2012.12.06
프로세스 죽이기  (0) 2012.12.06

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

확장자명으로 파일 찾고, 내용까지 출력한다. {} 는 출력값을 하나씩 대입한다는 뜻.

find /home -name '*.txt' -exec cat {} \; -print

find / -name '.forward' -exec cat {} \; -print
/home/test/.forward


신고

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

[root@www src]# cat test1.txt 
test test  test
test test test
[root@www src]# cat test2.txt 
test test   test
test test test



[root@www src]# diff test1.txt test2.txt 
1c1
< test test  test
---
> test test   test
[root@www src]# diff -w test1.txt test2.txt 
결과 없음.

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

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

url 이 아래와 같이 있다고 할때,

# cat list.txt 
naver.com
daum.net
google.co.kr

 

아래 처럼 실행하면, 모든 url 다운로드를 진행하게 된다.
# cat list.txt | xargs wget -c


--2012-11-16 14:24:09-- http://naver.com/
Resolving naver.com... 220.95.233.172, 220.95.233.171, 202.131.30.11, ...
Connecting to naver.com|220.95.233.172|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.naver.com/ [following]
--2012-11-16 14:24:09-- http://www.naver.com/
Resolving www.naver.com... 202.131.30.12, 202.131.30.11
Connecting to www.naver.com|202.131.30.12|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html'

[ <=> ] 99,910 --.-K/s in 0.009s

2012-11-16 14:24:09 (10.6 MB/s) - `index.html' saved [99910]

--2012-11-16 14:24:09-- http://daum.net/
Resolving daum.net... 61.111.62.173, 110.45.215.23, 114.108.157.19, ...
Connecting to daum.net|61.111.62.173|:80... connected.
HTTP request sent, awaiting response... 302 Object Moved
Location: http://www.daum.net/ [following]
--2012-11-16 14:24:09-- http://www.daum.net/
Resolving www.daum.net... 110.45.215.15, 114.108.157.116
Connecting to www.daum.net|110.45.215.15|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html'

100%[======================================>] 144,453 --.-K/s in 0.006s

2012-11-16 14:24:09 (24.7 MB/s) - `index.html' saved [144453]

--2012-11-16 14:24:09-- http://google.co.kr/
Resolving google.co.kr... 74.125.128.94, 2404:6800:4005:c00::5e
Connecting to google.co.kr|74.125.128.94|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.co.kr/ [following]
--2012-11-16 14:24:09-- http://www.google.co.kr/
Resolving www.google.co.kr... 74.125.128.94, 2404:6800:4005:c00::5e
Reusing existing connection to google.co.kr:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html'

7% [=> ] 11,081 --.-K/s in 0.04s

2012-11-16 14:24:09 (297 KB/s) - `index.html' saved [144453]

FINISHED --2012-11-16 14:24:09--
Downloaded: 3 files, 380K in 0.05s (7.26 MB/s)

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

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