bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Idea: jobs(1) -i to print only :%ID:s


From: alex xmb sw ratchev
Subject: Re: Idea: jobs(1) -i to print only :%ID:s
Date: Thu, 9 Nov 2023 20:26:19 +0100

On Thu, Nov 9, 2023, 8:10 PM Steffen Nurpmeso <steffen@sdaoden.eu> wrote:

> Steffen Nurpmeso wrote in
>  <20231109181645.BOCYg%steffen@sdaoden.eu>:
>  |Steffen Nurpmeso wrote in
>  | <20231109181107.Bj0wl%steffen@sdaoden.eu>:
>  ||Steffen Nurpmeso wrote in
>  || <20231109011212.tC9Hj%steffen@sdaoden.eu>:
>  || ...
>  ||Something like this that would be, adding JLIST_SPEC_ONLY and
>  ||jobs(1) -j.  Just in case of interest.
>  |
>  |I mean some scripting on "jobs | wc -l" would do that, though. :(
>
> Nah, that would be wrong.
>
>  |Maybe i should just write a function that builds the string
>  |necessary to do what i wanted with %* or "%1-2 %4" etc.
>
> So i did that (what a mess -- does anyone know how i can create an
> awk regular expression where parts of the expression is a variable
> that should be expanded?  ugh!  what do i know??):
>

awk -v var1='cont ent' -vv2="$other' ' { code } '

keep in mind that mass spawning of any bin is , when its done massley ,
very out ..

also var so awk processes some \esc caracters
to cleanly insert data , either use gawk ENVIRON["varname']
or via alternative fd or as part of file parse things

my='a b c'
# one line string
awk 3<<<"$my thing' BEGIN { f = "/dev/fd/3" ; getline v <f ; close( f ) }
other main code here '

foo=content
export foo
or foo=$foo gawk ..
gawk -vv=foo ' BEGIN { v = ENVIRON[ v ] } other code '
same as v = ENVIRON[ "v" ] or "varname"

to match in string , thers two ways , one is exact text match , the other
is regex

if u /foo/ thats a regex
$0 ~ "foo"

tx=" my text "
if ( $0 ~ "pre" tx "stu" ) { ye }
thers additional stuff to say containing substr() and match() , and some
others

#exact
etx = " exact "
if ( index( $0 , etx ) ) { ye }
if ( index( $0 , "pre" etx "stu" ) ) { ye }

  j() {
>     local j= a=${AWK:-awk}
>     [ $# -gt 0 ] && j='&& $2 !~ /(^| )('$(echo "$@" | tr ' ' '|')')( |$)/'
>     j=$(jobs -l | $a -F '[][]' '/^[[]/'"$j"'{print "%" $2}{next}')
>     echo $j
>   }
>
>  |Eh.  Forget about it.
>
> Sorry for the noise.
>
> --steffen
> |
> |Der Kragenbaer,                The moon bear,
> |der holt sich munter           he cheerfully and one by one
> |einen nach dem anderen runter  wa.ks himself off
> |(By Robert Gernhardt)
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]