使用sed命令去掉多余的行


想把一个文件里多余的空行替换成一行,使用一个Linux命令很快就能解决

sudo -i ‘/./,/^$/!d;${/./G}’ filename

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s