Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #201257

Re: Word-boundary mawk Debian Stretch

From john doe <johndoe65534@mail.com>
Newsgroups linux.debian.user
Subject Re: Word-boundary mawk Debian Stretch
Date 2018-10-15 13:40 +0200
Message-ID <wJ9o6-6MB-5@gated-at.bofh.it> (permalink)
References <wIJMZ-8uZ-1@gated-at.bofh.it> <wIMKS-1LW-3@gated-at.bofh.it> <wIN4e-1S0-9@gated-at.bofh.it> <wINdT-1V5-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/14/2018 1:55 PM, Étienne Mollier wrote:
> 
> 
> On 10/14/18 1:47 PM, john doe wrote:
>> Thank you, I was hoping for something with less pipes redirection but
>> given that portability is required, I might as wel go that way! :)
> 
> Sure, one less:
> 
> 	$ pattern=try grep -A1 -E "\<${pattern}\>" | mawk '{getline;print $2;exit}'
> (in)	noise
> (in)	Host try
> (in)	IdentityFile ~/.ssh/try/id_rsa1
> (in)	noise
> (in)	Host try
> (in)	IdentityFile ~/.ssh/try/id_rsa2
> (in)	noise
> (out)	~/.ssh/try/id_rsa1
> 
> and it should work as expected, this time.  :-)
> 

It is indeed, thank you.
Here's what I've come up with:

$ grep -A1 -E "\<${1}\>" ~/.ssh/config| awk '{getline;print $2;exit}'

Argument 1 ('${1}') is used because it is in a shell script/function.

-- 
John Doe

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Word-boundary mawk Debian Stretch john doe <johndoe65534@mail.com> - 2018-10-14 10:20 +0200
  Re: Word-boundary mawk Debian Stretch Étienne Mollier <etienne.mollier@mailoo.org> - 2018-10-14 13:30 +0200
    Re: Word-boundary mawk Debian Stretch john doe <johndoe65534@mail.com> - 2018-10-14 13:50 +0200
      Re: Word-boundary mawk Debian Stretch Étienne Mollier <etienne.mollier@mailoo.org> - 2018-10-14 14:00 +0200
        Re: Word-boundary mawk Debian Stretch john doe <johndoe65534@mail.com> - 2018-10-15 13:40 +0200
  Re: Word-boundary mawk Debian Stretch john doe <johndoe65534@mail.com> - 2018-10-14 13:50 +0200

csiph-web