1 |
On 02/04/14 15:00, Grant Edwards wrote: |
2 |
>On 2014-02-03, Alan McKinnon <alan.mckinnon@×××××.com> wrote: |
3 |
>> On 04/02/2014 01:14, Joseph wrote: |
4 |
>>> I have a text file. How do I search and replace "carriage return"? |
5 |
>>> |
6 |
>> |
7 |
>> |
8 |
>> That is a horrible one to solve :-) |
9 |
>> |
10 |
>> All the usual tools (grep, sed, tr) are line oriented so they will take |
11 |
>> one line and replace the CR at the end with something else plus a CR! |
12 |
> |
13 |
>No they won't. EOL in Unix is linefeed. CR is treated as a normal |
14 |
>character by grep sed tr and so on. |
15 |
> |
16 |
>-- |
17 |
>Grant Edwards grant.b.edwards Yow! I'm having an |
18 |
> at emotional outburst!! |
19 |
> gmail.com |
20 |
|
21 |
I solve it by converting text doc to unix format: |
22 |
dos2unix 1_5.txt |
23 |
|
24 |
and running this command: |
25 |
cat 1_5.txt | tr '\r\n' '\ ' > 1_52.txt |
26 |
|
27 |
-- |
28 |
Joseph |