Yanick Lafontaine
Yanick Lafontaine

Reputation: 190

Retrieve the rest of a line from a search

I have a file with these lines :

BDD_USER=use
BDD_PASS=password
BDD_NAME=database

I would like to get the password beside BDD_PASS=

Currently i'm trying grep command to retrieve this from Linux shell.

Like : grep 'BBD_PASS='

But this return the entire line i don't find any switch to get only the password.

Upvotes: 0

Views: 42

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185025

Give this a try:

grep -oP 'BDD_PASS=\K.*' file

Upvotes: 1

Related Questions