Here’s how to get a list of GCP projects.

<pre lang="bash">
gcloud projects list 

Result:

<pre lang="bash">
PROJECT_ID            NAME     PROJECT_NUMBER
your-project-id-xxxx  servers  xxxxxxxxxxxx

Use awk to display the project id only.

<pre lang="bash">
gcloud projects list | awk '{print $1}'

Result

<pre lang="bash">
PROJECT ID
your-project-id-xxxx