Saturday, May 4, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 4382  / 1 Year ago, sat, january 21, 2023, 4:45:11

I mean, when I run



dpkg -s thunar | grep "Depends"


it displays all dependencies for thunar file manager. How to run, for example



dpkg -s thunar | grep "Depends" | grep "gtk"


to display only dependencies containing gtk in its name ?


More From » command-line

 Answers
4
$ dpkg -s nautilus | grep "Depends" | grep -o "S*gtkS*"
libgtk-3-0


Explanation:




  • -o - Print only the matching part of the line

  • S* - Zero or more non-whitespace characters



If you want the version number too:



$ dpkg -s nautilus | grep "Depends" | grep -o "S*gtk[^,]*"
libgtk-3-0 (>= 3.9.12)



  • [^,]* - Zero or more characters which are not commas


[#6629] Monday, January 23, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brailloni

Total Points: 122
Total Questions: 108
Total Answers: 108

Location: North Korea
Member since Tue, Apr 4, 2023
1 Year ago
;