#!/bin/bash #author by luweinet@hhstu.edu.cn #Apr 27 2005 #for change file to unix format or change to dos format.: while getopts ud option do case $option in u) cat $2 | sed 's/^M$//' > $2.unix & ;; #M by Ctrl+V,Ctrl+M d) cat $2 | sed 's/$'''/`echo ///r`/''> $2.dos & ;; *) "echo Usage:./cinput filename {unix | dos}" esac done
change file to unix or to dos /just dos2unix unix2dos
最新推荐文章于 2025-12-26 16:04:52 发布
此博客提供了一段Bash脚本,用于将文件格式在Unix和DOS之间进行转换。脚本通过命令行选项判断转换方向,使用sed命令处理文件内容,可将文件转换为Unix格式或DOS格式。
1576

被折叠的 条评论
为什么被折叠?



