易截截图软件、单文件、免安装、纯绿色、仅160KB

Windows和Linux间文本文件格式转换

问题:在Linux下正常换行的文字,到了Windows下后,不再换行。
 
在Windows下换行时,有两个字符:回车(\r)和换行(\n)。但在Linux下,只有一个换行(\n)
可使用unix2dos和dos2unix命令进行格式的转换:
参数:
-k  保持输出文件和输入文件的日期时间戳不变
-o file   默认模式 . 将file转换,并输出到file
-n  infile outfile 新模式. 转换infile, 并输出到outfile
 
 
1.       unix2dos
 
假设用vi新建一文本文件,输入123456
[root@centos test]# ls -l a.txt
-rw-r--r-- 1 root root 7 Jan  7 21:31 a.txt
[root@centos test]# hexdump -c a.txt
0000000   1   2   3   4   5   6  \n
0000007
[root@centos test]# unix2dos -n a.txt b.txt
unix2dos: converting file a.txt to file b.txt in DOS format ...
[root@centos test]# ls -l
total 8
-rw-r--r-- 1 root root 7 Jan  7 21:31 a.txt
-rw------- 1 root root 8 Jan  7 21:34 b.txt
[root@centos test]# hexdump -c a.txt
0000000   1   2   3   4   5   6  \n
0000007
[root@centos test]# hexdump -c b.txt
0000000   1   2   3   4   5   6  \r  \n
0000008
b.txt是转换后的DOS下的文件
 
2.       dos2unix
[root@centos test]# dos2unix -n b.txt c.txt
dos2unix: converting file b.txt to file c.txt in UNIX format ...
[root@centos test]# ls -l
total 12
-rw-r--r-- 1 root root 7 Jan  7 21:31 a.txt
-rw------- 1 root root 8 Jan  7 21:34 b.txt
-rw------- 1 root root 7 Jan  7 21:38 c.txt
[root@centos test]# hexdump -c b.txt
0000000   1   2   3   4   5   6  \r  \n
0000008
[root@centos test]# hexdump -c c.txt
0000000   1   2   3   4   5   6  \n
0000007
c.txt是转换后unix下的文本文件
 


相关文档:

实战Linux Bluetooth编程(三) HCI层编程

1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI)  就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......

linux下的调试工具

转载时请注明出处和作者联系方式
文章出处:http://www.limodev.cn/blog
作者联系方式:李先静 <xianjimli at hotmail dot com>
随着XP的流行,人们越来越注重软件的前期设计、后期的实现,以及贯穿于其中的测试工作,经过这个过程出来的自然是高质量的软件。甚至有人声称XP会淘汰调试器!这当然是有一定道理的,� ......

虚拟机下linux的网络配置

      vmware三种网络连接,qemu两种网络连接实现 虚拟机<--->主机 虚拟机<--->互联网通信的方法。顺便写了下如何不重新编译整个内核支持某个功能,对系统无影响,编译速度要快于编译整个内核。如果你的XXX卡没被内核支持,又怕自己编译的内核会造成系统损坏就可以试试这个方法喽 ^_^
vm ......

Linux 2.6内核的新锁机制 RCU

http://www.ibm.com/developerworks/cn/linux/l-rcu/
函数摘要:
C代码
/*读者在读取由RCU保护的共享数据时使用该函数标记它进入读端临界区。*/ 
rcu_read_lock()  
/* 
该函数与rcu_read_lock配对使用,用以标记读者退出读端临界区。夹在这两个函数之间的代码区称为"读端临界区" ......

查看linux是32位还是64位

1.#uname -a
如果有x86_64就是64位的,没有就是32位的
2.# uname -m
x86_64
3.# arch
x86_64
4.#file /bin/cat
/bin/cat: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), stripped
5.查看cpu是多少位的
more /proc/cpuinfo
怎样查看 LI ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号