how to select
pid number
in
users:(("postgres",pid=1644,fd=3))
and pipe then to next command in terminal?

@Acer

Assume the string is in parameter x then…

y=${x##pid=}; echo${y%%,}

This is a way to do it without launching any additional processes.

(Note: There may be a way to nest these parameter expansions into one expression, but I don’t know how to do that, if it’s possible.)

@Pat

The result is empty.

@Pat

What does this pattern from?
I can check the manual

@Acer

When I tooted the first toot, it thought that the stars were to highlight text for italics, that’s why they didn’t print in the first toot. So, I made it an image instead.

This is “parameter expansion” in BASH.

man bash

section “Parameter Expansion”

@Pat

thanks I ll check the section

here it is in plain text...

y=${x##*pid=}; echo${y%%,*}

QOTO: Question Others to Teach Ourselves. A STEM-oriented instance.

An inclusive free speech instance.
All cultures and opinions welcome.
Explicit hate speech and harassment strictly forbidden.
We federate with all servers: we don't block any servers.