Can I extract arbitrary lines to stdout, rather than to the clipboard?

Kjetil Torgrim Homme kjetil.homme at
Sun Jun 28 21:33:46 CEST 2020

On 28/06/2020 20.54, yvh11a wrote:
> Hello everyone, nice to meet you all.
> Assuming I have secrets stored in as follows:
>      hunter2
>      my-email at
> I can do the following:
>      pass -c    -> sends hunter2 to clipboard
>      pass -c2   -> sends my-email at to the clipboard
>      pass       -> sends hunter2 to stdout
>      ?????                -> how to send my-email at to stdout?
> I'd like to know if there's a way to send arbitrary lines to stdout,
> as can be done to the clipboard. Alternatively, commit 3a108277 seems
> to allow extraction of fields other than the password, but only for
> emacs.  Does something similar exist from the command line?  Meaning,
> if I modified my file as such:
>      hunter2
>      email: my-email at
> could I do something like
>      pass :email -> send my-email at to stdout

there are so many ways to do this in Unix.  the version which probably 
is least typing for the first usecase is

   pass | sed -n 2p

-n turns off default print, 2p means on line 2, print.

your second feature is more awkward to type, so put it in an alias or 
function in your .bashrc:

   get() { sed -n "s/^$1: *//p"; }

usage will be:

   pass | get email

Kjetil T. Homme
Redpill Linpro - Changing the Game

More information about the Password-Store mailing list