企业转账到用户接口开通步骤详细介绍与解析
666
2022-09-22
sed 处理文件中 dos CR/LF
将dos控制字符^M替换掉;
# IN unix ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format) sed 's/^M$//' # in bash/tcsh, press Ctrl-V then Ctrl-M sed 's/.$//' # assumes that all lines end with CR/LF sed 's/\x0D$//' # gsed 3.02.80, but top script is easier # IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format sed "s/$/`echo -e \\\r`/" # command line under ksh sed 's/$'"/`echo \\\r`/" # command line under bash sed "s/$/`echo \\\r`/" # command line under zsh sed 's/$/\r/' # gsed 3.02.80
# IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format sed "s/$//" # method 1 sed -n p # method 2
# IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format # Cannot be done with DOS versions of sed. Use "tr" instead. tr -d \r outfile # GNU tr version 1.22 or higher
Example:删除文件中的所有空行和由空格组成的行; $cat ifile|sed '/^$/d'|sed '/^[[:space:]]*$/d' # method 1 $cat ifile|sed -e '/^$/d' -e '/^[[:space:]]*$/d' # method 2
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~