[英]Command to remove all white spaces in vim
I want to be able to remove all the white spaces in my txt file using vim 我希望能够使用vim删除txt文件中的所有空白
update reg04_rpt_animreg set birthdate = ' 2016-01-21 ' where animalid = ' TZN000192803889 ';
update reg04_rpt_animreg set birthdate = ' 2015-07-05 ' where animalid = ' TZN000192803890 ';
update reg04_rpt_animreg set birthdate = ' 2011-12-12 ' where animalid = ' TZN000192803891 ';
update reg04_rpt_animreg set birthdate = ' 2013-05-05 ' where animalid = ' TZN000192803893 ';
update reg04_rpt_animreg set birthdate = ' 2013-04-02 ' where animalid = ' TZN000192803894 ';
update reg04_rpt_animreg set birthdate = ' 2015-05-16 ' where animalid = ' TZN000192803895 ';
I have used the following command with vim but havent gotten my expected output 我在vim中使用了以下命令,但是没有得到预期的输出
:g/^\s*$/d
I think you're looking for the s
command; 我认为您正在寻找s
命令; :g/<regexp>/d
deletes the whole line which matches <regexp>
. :g/<regexp>/d
删除与<regexp>
匹配的整个行。
:%s/\s//g
This replaces all space-type characters ( \\s
) globally ( g
). 这将全局替换所有空格字符( \\s
)( g
)。
如果您只想在单引号内修剪空格,则应该可以:
:%s/= '\zs\s*\(\S*\)\s*'/\1'/g
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.