[Solved] a variable list filtering via sed + "blacklist-variable" && Print,sed & userdbctl an other Solution. (all under CCSA/GPL2/3, Take your pick, able to add ITBS) #76
-
dirlist=$(ls /home) => dirlist="blackcrack akira lost&found workshop garage office" the way to the result how become from the $dirlist i a filtering with the 3 words in the $blacklist i have try it via oneliner :
but it works not really simply with sed.. mus i use there a loop or something over "while" best |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Presuming your variables are as above: dirlist="blackcrack akira lost&found workshop garage office"
blacklist="lost&found garage workshop" If you turn them into arrays then yes, you can exclude one from the other: dirlist_array=(${dirlist})
blacklist_array=(${blacklist})
for x in ${blacklist_array[@]}
do
dirlist_array=("${dirlist_array[@]/$x}")
done That will give you: $ echo ${dirlist_array[@]}
blackcrack akira office Is that of any use? |
Beta Was this translation helpful? Give feedback.
Presuming your variables are as above:
If you turn them into arrays then yes, you can exclude one from the other:
That will give you:
Is that of any use?