I have the following output on my terminal
* These packages depend on app-portage/gentoolkit-0.6.5:
* These packages depend on app-portage/getuto-1.11:
sys-apps/portage-3.0.63 (!build ? app-portage/getuto)
* These packages depend on app-portage/portage-utils-0.96.1:
app-admin/perl-cleaner-2.31 (!pkgcore ? app-portage/portage-utils)
How do I only grep lines such as gentoolkit
that have no lines following it?
What I have tried : some command | xargs grep -eF ".*\n\n"
But this returns File or Directory not found
.
What I am trying to achieve?
In gentoo linux, eix-installed -a | xargs equery depends
gives the dependency for all packages. I want to find the ones that have no dependencies listed.
Although @oguz-ismail's answer would work with the sample output provided, it seems that actual equery
output becomes garbled when it is fed into a pipe.
This convoluted commandline seems to work around the problems:
</dev/null script -B /dev/null -f -q -c '
eix-installed -a | xargs equery depends
' |
tr -d '\r' |
grep -v '^---' |
awk '!/\n/' RS=
script
makes equery
believe it is writing to a terminal
script
's stdin from /dev/null
avoids some display oddities (cf. re-enable on-screen carriage return behaviour without including them in the data stream)tr
strips the carriage returns added by script
grep
filters some non-dependency info (per @konsolebox comment)awk
splits on empty lines and filters out multi-line records