Tôi tìm ra cách này:

cat test | tr "\003" "\n" > out.txt

Duy Hiếu
On 10/01/2010 04:40 PM, Duy-Hieu Bui wrote:
> Xin hỏi là "ETX" là ký tự có mã bao nhiêu (trong bảng ASCII).
> Tôi nghĩ có thể dùng lệnh tr để thay thế nó bằng ký tự \n.
> 
> chúc vui
> On 10/01/2010 08:59 AM, Nguyen Viet Ha wrote:
>> Chào cả nhà!
>>
>> Vẫn tiếp tục việc này, làm thế nào để tìm kiếm và thay thế các
>> non-printable character trong một file văn bản nhỉ? Ví dụ tôi có 1
>> file mà các đoạn kết thúc bằng ký tự ETX (end of text), giờ tôi
>> muốn thêm \n vào sau ký tự ETX (end of text) thì thế nào nhỉ.
>>
>> Hơi vụn vặt một tí :) Cảm ơn cả nhà.
>>
>>
>>
>>
>>
>>
>> 2010/9/30 MinhHoang To <[email protected]>
>>
>>> Ah ve viec co dong trang o dau thi minh thay cai PATTERN no co them cai lua
>>> chon OFFSET
>>>
>>>
>>> Read standard input if FILE is -.  Each PATTERN may be:
>>>
>>>        INTEGER
>>>               copy up to but not including specified line number
>>>
>>>        /REGEXP/[OFFSET]
>>>               copy up to but not including a matching line
>>>
>>>        %REGEXP%[OFFSET]
>>>               skip to, but not including a matching line
>>>
>>>        {INTEGER}
>>>               repeat the previous pattern specified number of times
>>>
>>>        {*}    repeat the previous pattern as many times as possible
>>>
>>>        A line OFFSET is a required `+' or `-' followed by a positive
>>> integer.
>>>
>>>
>>>
>>>  2010/9/30 MinhHoang To <[email protected]>
>>>
>>>>
>>>>  csplit [OPTION]... FILE PATTERN...
>>>>
>>>>
>>>>
>>>> Cai regular expression cho 1 blank line ( cai PATTERN trong truong hop nay
>>>> ) thi dung nhu cai parameter ban Bao danh vao
>>>>
>>>> http://www.faqs.org/docs/abs/HTML/regexp.html
>>>>
>>>>
>>>> --
>>>> Minh Hoang TO
>>>> eXoPlatform SAS, tang 8, building 18, Thai Ha, Ha Noi
>>>>
>>>
>>>
>>>
>>> --
>>> Minh Hoang TO
>>> eXoPlatform SAS, tang 8, building 18, Thai Ha, Ha Noi
>>>
>>> _______________________________________________
>>> POST RULES : http://wiki.hanoilug.org/hanoilug:mailing_list_guidelines
>>> _______________________________________________
>>> HanoiLUG mailing lists: http://lists.hanoilug.org/
>>> HanoiLUG wiki: http://wiki.hanoilug.org/
>>> HanoiLUG blog: http://blog.hanoilug.org/
>>>
>>
>>
>>
>> _______________________________________________
>> POST RULES : http://wiki.hanoilug.org/hanoilug:mailing_list_guidelines
>> _______________________________________________
>> HanoiLUG mailing lists: http://lists.hanoilug.org/
>> HanoiLUG wiki: http://wiki.hanoilug.org/
>> HanoiLUG blog: http://blog.hanoilug.org/
> 

Attachment: test
Description: Binary data

_______________________________________________
POST RULES : http://wiki.hanoilug.org/hanoilug:mailing_list_guidelines
_______________________________________________
HanoiLUG mailing lists: http://lists.hanoilug.org/
HanoiLUG wiki: http://wiki.hanoilug.org/
HanoiLUG blog: http://blog.hanoilug.org/

Trả lời cho