for 与 sed 结合逐行读取文件内容并分别写入新文件内





-exec command {} +:

This variant of the -exec action runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. The command line is built in much the same way that xargs builds its command lines. Only one instance of `{}’ is allowed within the command. The command is executed in the starting directory. If find encounters an error, this can sometimes cause an immediate exit, so some pending commands may not be run at all. This variant of -exec always returns true.





find . -type f -exec file ‘{}’ \;

Runs ‘file’ on every file in or below the current directory. Notice that the braces are enclosed in single quote  marks to protect them from interpretation as shell script punctuation. The semicolon(分号) is similarly protected by  the use of a backslash, though single quotes could have been used in that case also.