banner

[Rule] Rules  [Home] Main Forum  [Portal] Portal  
[Members] Member Listing  [Statistics] Statistics  [Search] Search  [Reading Room] Reading Room 
[Register] Register  
[Login] Loginhttp  | https  ]
 
Forum Index Thảo luận hệ điều hành *nix Shell script: Printf với new line  XML
  [Question]   Shell script: Printf với new line 11/09/2009 17:04:55 (+0700) | #1 | 192385
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
Mình có một file playlist.xml, nội dung như sau:
Code:
<?xml version="1.0" encoding="UTF-8"?>		
        <playlist version="1" xmlns = "http://xspf.org/ns/0/">
			<tracklist>

			
                <track>
                	<location>/music/Dark_Tranquillity/Projector/Dark_Tranquillity - Free_Card.mp3</location>
					<title>Free Card</title>
                	<creator>Dark Tranquillity</creator>
                    <image></image>
                </track>

			
                <track>
                	<location>/music/Dark_Tranquillity/Projector/Dark_Tranquillity - There_In.mp3</location>
					<title>There In</title>
                	<creator>Dark Tranquillity</creator>
                    <image></image>
                </track>

		...
snip
              ....

Mục đích của mình là muốn lấy đường dẫn tới file mp3 trong file này, nghĩa là đoạn
Code:
/music/Dark_Tranquillity/Projector/Dark_Tranquillity - There_In.mp3

Thật sự mình kém trong cái khâu cắt ghép, nên mình dùng một lúc cat, grep, sed và awk
Code:
03:52:13-cappuccino@home:~/project$cat playlist.xml  | grep mp3 | sed 's|<location>||' |sed 's|<\/location>||' | awk '{print $1}'
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity
/music/Dark_Tranquillity/Projector/Dark_Tranquillity

thì nó chỉ ra có mỗi khúc đầu, để ý giữa chữ y cuối cùng và dấu "-" có một khoản trắng (space) nên mình dùng awk để in ra 3 columns

Code:
cat playlist.xml  | grep mp3 | sed 's|<location>||' |sed 's|<\/location>||' | awk '{\
> for (i=1; i<=NF; i++)\
> printf("%s ", $i)\
> }'

nhưng kết quả nó ra thế này smilie
Code:
/music/Dark_Tranquillity/Projector/Dark_Tranquillity - Free_Card.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - There_In.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - Undo_Control.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - Auctioned.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - To_A_Bitter_Halt.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - The_Sun_Fired_Blanks.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - Nether_Novas.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - Day_To_End.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - Dober_Mann.mp3 /music/Dark_Tranquillity/Projector/Dark_Tranquillity - On_Your_Time.mp3

Lúc này lấy được cả 2 đoạn, nhưng lại mất đi phần new line (\n). Mình dùng printf để in ra new line nhưng không hiểu sao toàn báo lỗi:

Code:
03:56:35-cappuccino@home:~/project$cat playlist.xml  | grep mp3 | sed 's|<location>||' |sed 's|<\/location>||' | awk '{\
for (i=1; i<=NF; i++)\
printf("%s ", $i)\
 printf "\n"}' 
awk: cmd. line:3:  printf "\n"}
awk: cmd. line:3:  ^ syntax error


Hoặc dùng printf thế này cũng báo lỗi: printf("\n"smilie
Làm sao để in được new line trong awk?
Thanks.
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 11/09/2009 20:30:56 (+0700) | #2 | 192389
[Avatar]
tuantub
Member

[Minus]    0    [Plus]
Joined: 15/08/2006 06:45:48
Messages: 81
Offline
[Profile] [PM]
Code:
cat file.xml | awk -F '[<>]' '/mp3/{print $3}'

hoặc
Code:
awk -F '[<>]' '/mp3/{print $3}'  file.xml

hoặc :
Code:
cat file.xml | grep mp3 | sed -e 's/.*>\(.*\)<\/location.*/\1/'

hoặc:
Code:
sed -e 's/.*>\(.*\)<\/location.*/\1/' -e '/mp3/!d' file.xml

cũng được smilie
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 11/09/2009 23:05:11 (+0700) | #3 | 192404
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]
Mình thích cách này:

tuantub wrote:

Code:
awk -F '[<>]' '/mp3/{print $3}'  file.xml

 

Ở cách 1 và cách 3 thì lệnh 'cat' là thừa.

Mở rộng: trong trường hợp file nhạc kia có định dạng bất kỳ (wma, wav, rm,...) các bạn thử lấy nội dung nằm giữa 2 thẻ <location> và </location> xem ('trim' được mấy cái tab hoặc whitespace ở đầu dòng thì càng tốt).
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 01:11:10 (+0700) | #4 | 192423
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
Cám ơn tuantub và anh quanta.
Phần new line thì sao? Ai giải thích hộ mình được ko?
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 03:38:11 (+0700) | #5 | 192442
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

mR.Bi wrote:

...
Mình dùng printf để in ra new line nhưng không hiểu sao toàn báo lỗi:

Code:
03:56:35-cappuccino@home:~/project$cat playlist.xml  | grep mp3 | sed 's|<location>||' |sed 's|<\/location>||' | awk '{\
for (i=1; i<=NF; i++)\
printf("%s ", $i)\
 printf "\n"}' 
awk: cmd. line:3:  printf "\n"}
awk: cmd. line:3:  ^ syntax error


Hoặc dùng printf thế này cũng báo lỗi: printf("\n"smilie
Làm sao để in được new line trong awk?
Thanks.
 

Không cần dấu backslash mỗi khi xuống dòng.

Thử cái phần mở rộng anh đề cập ở trên đi smilie
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 03:50:41 (+0700) | #6 | 192444
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
Ặc ặc, đầu óc em đang ngu lên, không hiểu anh nói chỗ này lắm smilie
cái backslash em thêm vào vì em đặt nó trong script.
Còn cái printf anh?
Tối về em sẽ thử.
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 04:00:08 (+0700) | #7 | 192446
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

mR.Bi wrote:
Ặc ặc, đầu óc em đang ngu lên, không hiểu anh nói chỗ này lắm smilie
cái backslash em thêm vào vì em đặt nó trong script.
Còn cái printf anh?
 

He he, chính nó là nguyên nhân gây nên lỗi đấy:
Code:
$ grep mp3 file.xml | sed 's/<location>//' | sed 's/<\/location>//' | awk '{
> for (i=1; i<=NF; i++)
> printf ("%s ", $i)
> printf "\n"
> }'
/music/Dark_Tranquillity/Projector/Dark_Tranquillity - Free_Card.mp3 
/music/Dark_Tranquillity/Projector/Dark_Tranquillity - There_In.mp3
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 04:21:42 (+0700) | #8 | 192452
[Avatar]
tuantub
Member

[Minus]    0    [Plus]
Joined: 15/08/2006 06:45:48
Messages: 81
Offline
[Profile] [PM]

quanta wrote:
Mình thích cách này:

tuantub wrote:

Code:
awk -F '[<>]' '/mp3/{print $3}'  file.xml

 

Ở cách 1 và cách 3 thì lệnh 'cat' là thừa.

Mở rộng: trong trường hợp file nhạc kia có định dạng bất kỳ (wma, wav, rm,...) các bạn thử lấy nội dung nằm giữa 2 thẻ <location> và </location> xem ('trim' được mấy cái tab hoặc whitespace ở đầu dòng thì càng tốt)

Lệnh sed sau đó giải quyết việc trên smilie (do vậy tới mới đưa ra nhiều lệnh để thử smilie)
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 04:54:46 (+0700) | #9 | 192459
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

tuantub wrote:

quanta wrote:

Mở rộng: trong trường hợp file nhạc kia có định dạng bất kỳ (wma, wav, rm,...) các bạn thử lấy nội dung nằm giữa 2 thẻ <location> và </location> xem ('trim' được mấy cái tab hoặc whitespace ở đầu dòng thì càng tốt). 

Lệnh sed sau đó giải quyết việc trên smilie (do vậy tới mới đưa ra nhiều lệnh để thử smilie

Lúc đó thì pattern của bạn là gì nhỉ? smilie

Mở rộng tiếp là file đó có nội dung kiểu thế này đi:
Code:
<location>
	/music/Dark_Tranquillity/Projector/Dark_Tranquillity - Free_Card.mp3
</location>
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 05:31:40 (+0700) | #10 | 192464
[Avatar]
tuantub
Member

[Minus]    0    [Plus]
Joined: 15/08/2006 06:45:48
Messages: 81
Offline
[Profile] [PM]
Hi hi, @quanta chơi quả này làm khó nhau òi smilie
Theo tớ nghĩ là tìm tất cả các dòng chứa mp3 và xoá <location> cùng với </location> đi là được smilie
Code:
grep mp3 file.xml| sed -e 's/<location>\|<\/location>//g' -e 's/^ \+\|\t//g'

[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 05:54:16 (+0700) | #11 | 192466
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

tuantub wrote:
Hi hi, @quanta chơi quả này làm khó nhau òi smilie
Theo tớ nghĩ là tìm tất cả các dòng chứa mp3 và xoá <location> cùng với </location> đi là được smilie
Code:
grep mp3 file.xml| sed -e 's/<location>\|<\/location>//g' -e 's/^ \+\|\t//g'

 

Ơ, chưa được mà tuantub ơi?

quanta wrote:
Mở rộng: trong trường hợp file nhạc kia có định dạng bất kỳ (wma, wav, rm,...) các bạn thử lấy nội dung nằm giữa 2 thẻ <location> và </location> xem ('trim' được mấy cái tab hoặc whitespace ở đầu dòng thì càng tốt).
 

Phần màu cam bạn định xử lý kiểu gì? Tất nhiên là không chơi kiểu egrep nhé, vì biết nó có bao nhiêu định dạng đâu mà lọc.

Phần màu vàng bạn chú ý xử lý khi mà nội dung nó xuống dòng (như mình đã ví dụ ở trên) nữa nhé.
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 05:58:08 (+0700) | #12 | 192467
[Avatar]
tuantub
Member

[Minus]    0    [Plus]
Joined: 15/08/2006 06:45:48
Messages: 81
Offline
[Profile] [PM]

quanta wrote:

tuantub wrote:
Hi hi, @quanta chơi quả này làm khó nhau òi smilie
Theo tớ nghĩ là tìm tất cả các dòng chứa mp3 và xoá <location> cùng với </location> đi là được smilie
Code:
grep mp3 file.xml| sed -e 's/<location>\|<\/location>//g' -e 's/^ \+\|\t//g'

 

Ơ, chưa được mà tuantub ơi?

quanta wrote:
Mở rộng: trong trường hợp file nhạc kia có định dạng bất kỳ (wma, wav, rm,...) các bạn thử lấy nội dung nằm giữa 2 thẻ <location> và </location> xem ('trim' được mấy cái tab hoặc whitespace ở đầu dòng thì càng tốt).
 

Phần màu cam bạn định xử lý kiểu gì? Tất nhiên là không chơi kiểu egrep nhé, vì biết nó có bao nhiêu định dạng đâu mà lọc.

Phần màu vàng bạn chú ý xử lý khi mà nội dung nó xuống dòng (như mình đã ví dụ ở trên) nữa nhé.
 

Thua smilie
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 11:31:36 (+0700) | #13 | 192524
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
haha, cái này là đề ra bị "lủng", trong cái file đó có thiếu gì pattern mà phải nhắm vào mp3.
Code:
grep music playlist.xml | sed -e 's/<location>\|<\/location>//g' -e 's/^ \+\|\t//g'

còn cái dụ mà ko có pattern nào thì em chưa nghĩ ra. Vì cái file đó quá dài, em đang tò mò ko biết anh cắt thế nào?
Còn cái printf, em thấy nó vô lí thế nào ấy? Nếu em đặt trong scirpt mà ko có backslash thì làm thế nào anh?

All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 11:55:15 (+0700) | #14 | 192526
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

mR.Bi wrote:
haha, cái này là đề ra bị "lủng", trong cái file đó có thiếu gì pattern mà phải nhắm vào mp3.
Code:
grep music playlist.xml | sed -e 's/<location>\|<\/location>//g' -e 's/^ \+\|\t//g'

còn cái dụ mà ko có pattern nào thì em chưa nghĩ ra. Vì cái file đó quá dài, em đang tò mò ko biết anh cắt thế nào?
 

Thôi lấy ví dụ thế này đi:

Mình có một file input thế này:

Code:
<track>
      <location>
	      /home/quanta/Nhin nhung mua thu di.mp3
      </location>
      <title>
	      Free Card
      </title>
      <creator>
	      Dark Tranquillity
      </creator>
</track>

<track>
      <location>
	      /mnt/data/music/Nhac Trinh/Dem thay ta la thac do.wma
      </location>
      <title>
	      Free Card
      </title>
      <creator>
	      Dark Tranquillity
      </creator>
</track>

<track>
      <location>/tmp/Ha trang.wav</location>
      <title>
	      Free Card
      </title>
      <creator>
	      Dark Tranquillity
      </creator>
</track>

Bạn nào cắt giùm mình để output nó là:

/home/quanta/Nhin nhung mua thu di.mp3
/mnt/data/music/Nhac Trinh/Dem thay ta la thac do.wma
/tmp/Ha trang.wav
 

với?
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 12:25:46 (+0700) | #15 | 192529
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

mR.Bi wrote:

...
Còn cái printf, em thấy nó vô lí thế nào ấy? Nếu em đặt trong scirpt mà ko có backslash thì làm thế nào anh?

 

Em đang dùng loại shell nào (bash, csh, ksh...). Anh vừa đọc lại và test thử có mỗi csh nó mới cần backslash thôi đấy chứ. Em thử lại xem.
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 20:21:17 (+0700) | #16 | 192545
[Avatar]
tuantub
Member

[Minus]    0    [Plus]
Joined: 15/08/2006 06:45:48
Messages: 81
Offline
[Profile] [PM]
Tớ mới thử :
Code:
grep -e  'mp3\|MP3\|wav\|WAV\|wma\|WMA\|ogg\|OGG' file.xml | sed -e 's/<location>\|<\/location>//g' -e 's/.*[\+ \t\+]\/\(.*\)/\/\1/g'
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 12/09/2009 21:38:35 (+0700) | #17 | 192553
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

tuantub wrote:
Tớ mới thử :
grep -e 'mp3\|MP3\|wav\|WAV\|wma\|WMA\|ogg\|OGG' file.xml | sed -e 's/<location>\|<\/location>//g' -e 's/.*[\+ \t\+]\/\(.*\)/\/\1/g' 
 

He he, đã nói là không chơi 'egrep' mà. Bài toán đặt ra ở đây là không biết có những định dạng audio nào để mà lọc.
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 11:23:36 (+0700) | #18 | 192720
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
Em đang đi theo hướng lọc số backslash trên một line, nhưng chưa ra.
Không ấy thì anh...giải luôn đi cho em nhờ smilie .
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 11:29:55 (+0700) | #19 | 192721
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

mR.Bi wrote:
Em đang đi theo hướng lọc số backslash trên một line, nhưng chưa ra.
Không ấy thì anh...giải luôn đi cho em nhờ smilie

Làm gì mà "nóng" thế em?

Em đã bao giờ gặp trường hợp grep pattern ở một dòng nhưng lại muốn lấy dòng ngay dưới nó chưa vậy?
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 11:47:45 (+0700) | #20 | 192722
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
Code:
grep -A 1 "<location>" quanta.txt | sed -e 's/<location>\|<\/location>//g' -e 's/.*[\+ \t\+]\/\(.*\)/\/\1/g' -e 's/<title>//' -e 's/--//'

Cái gợi ý của anh, với một đống sed ngu si của em smilie
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 12:00:05 (+0700) | #21 | 192723
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

mR.Bi wrote:
Code:
grep -A 1 "<location>" quanta.txt | sed -e 's/<location>\|<\/location>//g' -e 's/.*[\+ \t\+]\/\(.*\)/\/\1/g' -e 's/<title>//' -e 's/--//'

Cái gợi ý của anh, với một đống sed ngu si của em smilie  

Quá lời, quá lời.

- Sao mọi người cứ thích lấy tất cả rồi lại thay bằng \1 làm gì nhỉ? Sao không chỉ xóa mỗi đoạn đầu đi thôi?
- Còn blank lines nữa kìa em

Còn một (hoặc nhiều) cách nữa dùng awk theo anh là hay hơn, tổng quát hơn, em thử nghĩ em.
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 12:50:40 (+0700) | #22 | 192725
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
btw, cái cuối cùng, em...nhức đầu quá rồi smilie
Code:
grep -A 1 "<location>" quanta.txt | sed -e 's/<location>\|<\/location>//g' -e 's/[\ \\-]*//' -e 's/<title>//' -e '/^$/d' -e 's/^[ \t]*//'

tặng mọi người thêm cái này http://sed.sourceforge.net/sed1line.txt
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 22:34:11 (+0700) | #23 | 192733
[Avatar]
tuantub
Member

[Minus]    0    [Plus]
Joined: 15/08/2006 06:45:48
Messages: 81
Offline
[Profile] [PM]
Okie, tớ không rõ lắm về awk, chỉ có thể đưa thử cái nè :
Code:
awk  '/<location>/,/<\/location>/' file.xml | sed -e 's/<location>\|<\/location>//g' -e 's/.*[\+ \t\+]\//\//g' -e '/^[\t\| ]\+$/d'

bồ @quanta thử đưa cách của bồ coi sao nè? b-)
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 22:58:50 (+0700) | #24 | 192736
[Avatar]
quanta
Moderator

Joined: 28/07/2006 14:44:21
Messages: 7265
Location: $ locate `whoami`
Offline
[Profile] [PM]

tuantub wrote:
Okie, tớ không rõ lắm về awk, chỉ có thể đưa thử cái nè :
Code:
awk  '/<location>/,/<\/location>/' file.xml | sed -e 's/<location>\|<\/location>//g' -e 's/.*[\+ \t\+]\//\//g' -e '/^[\t\| ]\+$/d'

bồ @quanta thử đưa cách của bồ coi sao nè? b-) 

Hì, đúng ý mình rồi, cách của mình ngắn hơn một chút:
awk '/<location>/,/<\/location>/' file.xml | sed -e 's/<location>\|<\/location>//g' -e 's/^[ \t]*//g' -e '/^$/d' 
Let's build on a great foundation!
[Up] [Print Copy]
  [Question]   Shell script: Printf với new line 14/09/2009 23:04:42 (+0700) | #25 | 192737
mR.Bi
Member

[Minus]    0    [Plus]
Joined: 22/03/2006 13:17:49
Messages: 812
Offline
[Profile] [PM] [WWW]
2 vị thật là phi phàm smilie.
All of my life I have lived by a code and the code is simple: "honour your parent, love your woman and defend your children"
[Up] [Print Copy]
[digg] [delicious] [google] [yahoo] [technorati] [reddit] [stumbleupon]
Go to: 
 Users currently in here 
1 Anonymous

Powered by JForum - Extended by HVAOnline
 hvaonline.net  |  hvaforum.net  |  hvazone.net  |  hvanews.net  |  vnhacker.org
1999 - 2013 © v2012|0504|218|