i wanna type control chars \r not the \ and r itself thx
bird
11:43 pm on Mar 17, 2003 (gmt 0)
You can type in control chars if you type a ^V (ctrl-V) first. So in you case, the following will print an empty line:
$> echo '^V^R'
[/code] [code]$>
(You won't actually see the ^V on screen anymore after typing the ^R)
Xuefer
2:02 am on Mar 18, 2003 (gmt 0)
got it ^V^J^V^M right? :)
littleman
6:54 am on Mar 18, 2003 (gmt 0)
Gotta ask...why do you need to do this?
bird
12:20 pm on Mar 18, 2003 (gmt 0)
got it ^V^J^V^M
Actually, if you're trying to emulate DOS line endings, you'll probably want to reverse that. At least with my terminal settings, ^J ~= \n, and ^M ~= \r. Other than that, you seem to be on the right track.
Xuefer
3:54 pm on Mar 18, 2003 (gmt 0)
thx bird
grep -n '^V^M^V^J' *.txt scan for dos text :)
u have better way to do it?
bird
5:41 pm on Mar 18, 2003 (gmt 0)
Have a look at the file command:
$> file some.txt some.txt: ASCII text, with CRLF line terminators
It won't scan through the full text, so it may miss files where the line endings are mixed, but it's usually quite reliable for uniform files.
Xuefer
2:11 am on Mar 19, 2003 (gmt 0)
nice :) but [Administrator@my abc]$ file a.php a.php: PHP script text