在bash中使用iconv更改编码多个文件 [英] Change encoding multiple file with iconv in bash

查看:133
本文介绍了在bash中使用iconv更改编码多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用iconv更改多个php文件编码。

I want to change multiple php files encoding with iconv.

我使用find和exec选项(参考: http://linux.bigresource.com/Ubuntu-Encoding-Conversion-on-Multiple-Files--4fuXvUwbN .html

I use find and exec option (Reference : http://linux.bigresource.com/Ubuntu-Encoding-Conversion-on-Multiple-Files--4fuXvUwbN.html)

find . -type f -name '*.php' -print -exec iconv -f euc-kr -t utf-8 {} -o {}.utf8 

但是发生了错误。

find: missing argument to `-exec'

我只想一次转换所有php文件。
如何在bash中使用一个语句来完成此操作?

I just want to convert all php files in a once time. How can i do this with one statement in a bash?

推荐答案

您必须将 \; + -exec 操作的结尾。

You must put either \; or + at the end of the -exec action.

find . -type f -name '*.php' -print -exec iconv -f euc-kr -t utf-8 {} -o {}.utf8 \;

这篇关于在bash中使用iconv更改编码多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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