转换所有文件DOS2UNIX的行结束在一个目录 [英] convert dos2unix line endings for all files in a directory

查看:118
本文介绍了转换所有文件DOS2UNIX的行结束在一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Curretly我使用下面的命令来更改DOS2UNIX的行结尾,但这是文件-Y file..is出现在目录中运行此命令所有文件的方式

  SED -i的/ \\ r //'文件名转换DOS2UNIX的行结束

谢谢,


`中找到解决方案

 对我。型的F \\(-name* .c在-o -name* .h头\\)`;做的sed -i'S / \\ r //'$ I; DONE

Curretly I am using the following command to change dos2unix line endings,but this is for file-y file..is there a way to run this command for all the files in a directory

sed -i 's/\r//' filename to convert dos2unix line endings

Thanks,

解决方案

for i in `find . -type f \( -name "*.c" -o -name "*.h" \)`; do    sed -i 's/\r//' $i ; done

这篇关于转换所有文件DOS2UNIX的行结束在一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆