由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - how to get rid of the ^M in files?
相关主题
how to let awk not print?Perl问题求助
帮帮忙,用C作一个SHELLRe: 为什么emacs自动给我加^M.
C++5.0的初级问题how to remove ^M in my file
Help: convert // to /* */ in C code?再次急问: *.tgz 文件怎么解?
Perl问题求助 (转载)Re: 怎么在UNIX下面放CD?
A question about command timebooks about advanced UNIX command
perl Q在unix下怎么听CD亚
双面打印[转载] how to see which port in use?
相关话题的讨论汇总
话题: files话题: rid话题: get话题: dos2unix话题: perl
进入Unix版参与讨论
1 (共1页)
r*u
发帖数: 63
1
Is the ^M in unix files the "enter" in windows files? Any easy way to
get them out? Many thanks.
r*u
发帖数: 63
2
I got it.
in VI use the command :%s/^V^M//g
in unixshell sed 's/^V^M//g'foo > foo.new
where ^V^M means control+v then control+M.

【在 r*u 的大作中提到】
: Is the ^M in unix files the "enter" in windows files? Any easy way to
: get them out? Many thanks.

l****g
发帖数: 21
3
u don't need the /g part, 'coz there will be only one ^M per line, otherwise
you got a problem.

【在 r*u 的大作中提到】
: I got it.
: in VI use the command :%s/^V^M//g
: in unixshell sed 's/^V^M//g'foo > foo.new
: where ^V^M means control+v then control+M.

r*u
发帖数: 63
4
I'm not sure what this g means here. But it seems ok. Could you tell me
what the problem would be? thanks.

【在 l****g 的大作中提到】
: u don't need the /g part, 'coz there will be only one ^M per line, otherwise
: you got a problem.

c**v
发帖数: 103
5
dos2unix

【在 r*u 的大作中提到】
: I'm not sure what this g means here. But it seems ok. Could you tell me
: what the problem would be? thanks.

G**T
发帖数: 388
6
dos2unix, unix2dos

【在 l****g 的大作中提到】
: u don't need the /g part, 'coz there will be only one ^M per line, otherwise
: you got a problem.

r**m
发帖数: 13
7
dos2unix: Command not found.
how can I do?

【在 G**T 的大作中提到】
: dos2unix, unix2dos
d*******n
发帖数: 9
8
vi, :%s/^v^m//g

【在 r**m 的大作中提到】
: dos2unix: Command not found.
: how can I do?

l******t
发帖数: 8
9
dos2unix.pl xxx.dos > xxx.unix
The following is the perl file. Don't forget to make it executable.
#!/usr/bin/perl
while(<>){
if($_ =~ /(.*)\r/)
{
print($1, "\n");
}
else
{
print($_);
}
}

【在 d*******n 的大作中提到】
: vi, :%s/^v^m//g
1 (共1页)
进入Unix版参与讨论
相关主题
[转载] how to see which port in use?Perl问题求助 (转载)
How to remove a line from a file?A question about command time
A Unix questionperl Q
pine中的中文输入问题双面打印
how to let awk not print?Perl问题求助
帮帮忙,用C作一个SHELLRe: 为什么emacs自动给我加^M.
C++5.0的初级问题how to remove ^M in my file
Help: convert // to /* */ in C code?再次急问: *.tgz 文件怎么解?
相关话题的讨论汇总
话题: files话题: rid话题: get话题: dos2unix话题: perl