LINUX.ORG.RU

История изменений

Исправление egzakharovich, (текущая версия) :

function exclude()
{
  while IFS="" read -r line
  do
    for a in "${@}"
    do
      if grep -qE "^${a}\$" <<< "${line}"
      then
        continue 2
      fi
    done
    echo "${line}"
  done
}

Работает

$ echo -e 'one\ntwo\nthree\nfour' | exclude two three
one
four

Ещё поправил, чтобы он только с целой строкой работал

echo -e 'one\ntwo two\nthree\nfour' | exclude two one
two two
three
four

Всё

Исправление egzakharovich, :

function exclude()
{
  while IFS="" read -r line
  do
    for a in "${@}"
    do
      if grep -qF "${a}" <<< "${line}"
      then
        continue 2
      fi
    done
    echo "${line}"
  done
}

Работает

$ echo -e 'one\ntwo\nthree\nfour' | exclude two three
one
four

Исправление egzakharovich, :

function exclude()
{
  while IFS="" read -r line
  do
    for a in "${@}"
    do
      if grep -qF "${a}" <<< "${line}"
      then
        continue 2
      fi
    done
    echo "${line}"
  done
}

Исправление egzakharovich, :

function exclude()
{
  while IFS="" read -r line
  do
    for a in "${@}"
    do
      if grep -q "${a}" <<< "${line}"
      then
        continue 2
      fi
    done
    echo "${line}"
  done
}

Исправление egzakharovich, :

function exclude()
{
  while IFS="" read -r line
  do
    for a in "${@}"
    do
      if grep -q "${1}" <<< "${line}"
      then
        continue 2
      fi
    done
    echo "${line}"
  done
}

Не проверял пока

Исходная версия egzakharovich, :

function exclude()
{
  while IFS="" read -r line
  do
    for a in "${@}"
    do
      if grep -q "${1}" <<< "${line}"
      then
        break 2
      fi
    done
    echo "${line}"
  done
}

Не проверял пока