简体   繁体   English

使用sed从mysql删除字符

[英]using sed to remove characters from mysql

I use the following script to dump mysql database names and then remove all unwanted chars(leading trailing | and spaces). 我使用以下脚本转储mysql数据库名称,然后删除所有不需要的字符(前导|和空格)。 It works in removing all of them though the sed is intended only to remove leading spaces.... why? 尽管sed仅用于删除前导空格,但它可以删除所有它们。...为什么?

mysql -uuser -pmypass--skip-column-names -e "select schema_name from information_schema.schemata where schema_name not in ('Linking', 'information_schema');" | sed 's/^ *//'

尝试这个 :

sed 's/^ *//;s/ *$//'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM