'How do I get only names of active plugins in Wordpress?

I am trying to to get list of active Wordpress plugins and for that I am using wp plugin list --status=active --allow-root command.

That gives me putout like this.

+----------------+--------+--------+---------+
| name           | status | update | version |
+----------------+--------+--------+---------+
| akismet        | active | none   | 4.2.2   |
| classic-editor | active | none   | 1.6.2   |
| contact-form-7 | active | none   | 5.5.6   |
| wordfence      | active | none   | 7.5.9   |
| wpforms-lite   | active | none   | 1.7.3   |
+----------------+--------+--------+---------+

Not sure how do I remove extra tables and get only names of the plugin such as

akismet
classic-editor
contact-form-7
wordfence
wpforms-lite

any help in this matter would be appreciated



Solution 1:[1]

I managed to get the result using awk and grep

wp plugin list --status=active --allow-root > list.txt cat list.txt | awk '{print $1}' | grep -v -e "name" > plugin.txt

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RavinderSingh13