简体   繁体   中英

remove string before "="symbol in shell script

I Have a CSV file output generated from some script as below:

name=1.1.1.1,managementaddress=1.1.2.1,,
name=1.2.2.1,managementaddress=1.1.2.1,activeaddress=1.1.2.1,activereadCommunity=public
name=1.1.2.9,managementaddress=1.1.2.9,activeaddress=1.1.2.9,activereadCommunity=public
name=1.1.2.16,managementaddress=1.1.2.16,,
name=1.1.2.2,managementaddress=1.1.2.2,,

from this output i want to remove the strings which are before "=" symbol. like the output should be:

1.1.1.1,1.1.2.1,,
1.2.2.1,1.1.2.1,1.1.2.1,public
1.1.2.9,1.1.2.9,1.1.2.9,public
1.1.2.16,1.1.2.16,,
1.1.2.2,1.1.2.2,,

With sed and a regex:

sed 's/[^=,]*=//g' file

Output:

1.1.1.1,1.1.2.1,,
1.2.2.1,1.1.2.1,1.1.2.1,public
1.1.2.9,1.1.2.9,1.1.2.9,public
1.1.2.16,1.1.2.16,,
1.1.2.2,1.1.2.2,,

See man sed and The Stack Overflow Regular Expressions FAQ

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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