linux - How to generate string elements that don't match a pattern? -


if have

days="1 2 3 4 5 6"  func() {     echo "lsecure1"     echo "lsecure"     echo "lsecure4"     echo "lsecure6"     echo "something else" } 

and do

func | egrep "lsecure[1-6]" 

then get

lsecure1 lsecure4 lsecure6 

but is

lsecure2 lsecure3 lsecure5 

which days doesn't have lsecure string.

question

my current idea use awk split $days , loop on combinations.

is there better way?

note grep -v inverts sense of plain grep , not solve problem not generate required strings.

i not sure trying achieve, might consider using uniq -u deletes repeated sequences. example can it:

( echo "$days" | tr -s ' ' '\n'; func | grep -op '(?<=lsecure)[1-6]' ) | sort | uniq -u 

output:

2 3 5 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -