Gangmax Blog

Filter with grep, sed and tr

From here, here, here and here.

The purpose is to get the id list from the whole output of the “dbutils” command, which is used to perform the “delete” command.

1
2
./dbutils list StorageSystem | grep 'id:' | sed -e 's/id: //g' | tr '\n' ' '
urn:storageos:StorageSystem:dca2336f-8703-4333-9a11-24f8985e26b7:vdc1 urn:storageos:StorageSystem:8109e77a-4bf1-47e9-bfb7-4ce74a4f899b:vdc1 urn:storageos:StorageSystem:dfa6f0e2-22a9-4b3b-a4fd-f37ef1235398:vdc1 urn:storageos:StorageSystem:0d384402-5a0a-4e7a-93d1-00604dd6ec5a:vdc1 urn:storageos:StorageSystem:148650c8-f248-4cda-af34-49f05fc403da:vdc1 urn:storageos:StorageSystem:c74ac64a-046f-4f84-9f4b-bbd053259a87:vdc1

Comments