Skip to main content
removed trailing space in pattern (in re: a comment posted as an Answer at https://unix.stackexchange.com/a/555152/117549)
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 267

Try the following:

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[\(][^)]*[\)] //g'

First of all, dpkg-checkbuilddeps prints out the error to stderr not stdout. So it needs to be redirected to stdout to use pipeline.

Here is how to Redirect stderr and stdout in Bash

You used the regex ([^)]*) on:

sed 's/([^)]*)//g'

But it should be:

sed 's/[\(][^)]*[\)] //g'

Reference: Using sed to delete a string between parentheses

Try the following:

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[\(][^)]*[\)] //g'

First of all, dpkg-checkbuilddeps prints out the error to stderr not stdout. So it needs to be redirected to stdout to use pipeline.

Here is how to Redirect stderr and stdout in Bash

You used the regex ([^)]*) on:

sed 's/([^)]*)//g'

But it should be:

sed 's/[\(][^)]*[\)] //g'

Reference: Using sed to delete a string between parentheses

Try the following:

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[\(][^)]*[\)] //g'

First of all, dpkg-checkbuilddeps prints out the error to stderr not stdout. So it needs to be redirected to stdout to use pipeline.

Here is how to Redirect stderr and stdout in Bash

You used the regex ([^)]*) on:

sed 's/([^)]*)//g'

But it should be:

sed 's/[\(][^)]*[\)]//g'

Reference: Using sed to delete a string between parentheses

Try

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies the following: //g' | sed 's/[(][^)]*[)] //g'

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[\(][^)]*[\)] //g'

First of all, dpkg-checkbuilddepsdpkg-checkbuilddeps prints out the error to stderrstderr not stdoutstdout. So it needs to be redirected to stdoutstdout to use pipeline.

Redirect stderr and stdout in Bash Here is how to https://stackoverflow.com/questions/637827/redirect-stderr-and-stdout-in-bashRedirect stderr and stdout in Bash

You used the regex ([^)]*)([^)]*) on:

sed 's/([^)]*)//g'

sed 's/([^)]*)//g'

But it should be:

sed 's/[(][^)]*[)] //g'

sed 's/[\(][^)]*[\)] //g'

Reference: https://stackoverflow.com/questions/27825977/using-sed-to-delete-a-string-between-parenthesesUsing sed to delete a string between parentheses

Try

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[(][^)]*[)] //g'

First of all, dpkg-checkbuilddeps prints out the error to stderr not stdout. So it needs to be redirected to stdout to use pipeline.

Redirect stderr and stdout in Bash https://stackoverflow.com/questions/637827/redirect-stderr-and-stdout-in-bash

You used the regex ([^)]*) on

sed 's/([^)]*)//g'

But it should be

sed 's/[(][^)]*[)] //g'

https://stackoverflow.com/questions/27825977/using-sed-to-delete-a-string-between-parentheses

Try the following:

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[\(][^)]*[\)] //g'

First of all, dpkg-checkbuilddeps prints out the error to stderr not stdout. So it needs to be redirected to stdout to use pipeline.

Here is how to Redirect stderr and stdout in Bash

You used the regex ([^)]*) on:

sed 's/([^)]*)//g'

But it should be:

sed 's/[\(][^)]*[\)] //g'

Reference: Using sed to delete a string between parentheses

Source Link

Try

dpkg-checkbuilddeps 2>&1 | sed 's/dpkg-checkbuilddeps:\serror:\sUnmet build dependencies: //g' | sed 's/[(][^)]*[)] //g'

First of all, dpkg-checkbuilddeps prints out the error to stderr not stdout. So it needs to be redirected to stdout to use pipeline.

Redirect stderr and stdout in Bash https://stackoverflow.com/questions/637827/redirect-stderr-and-stdout-in-bash

You used the regex ([^)]*) on

sed 's/([^)]*)//g'

But it should be

sed 's/[(][^)]*[)] //g'

https://stackoverflow.com/questions/27825977/using-sed-to-delete-a-string-between-parentheses