Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 679  / 3 Years ago, fri, may 21, 2021, 6:27:05

Latest upgrade borked my system and I`m trying to revert the last upgrade. I opened my comp with live USB and chrooted to partition that is OS installed. I get the upgraded packages with



cat /var/log/dpkg.log | grep upgrade >>upgradeddpkg


It lists pakages like



2014-03-14 15:31:45 upgrade libprocps0:i386 1:3.3.3-2ubuntu5.3 1:3.3.3-3
2014-03-14 15:31:52 upgrade libreadline-dev:i386 6.2-9ubuntu1 6.2+dfsg-0.1
2014-03-14 15:31:53 upgrade libreadline6-dev:i386 6.2-9ubuntu1 6.2+dfsg-0.1
2014-03-14 15:31:55 upgrade readline-common:all 6.2-9ubuntu1 6.2+dfsg-0.1
2014-03-14 15:32:25 upgrade libreadline6:i386 6.2-9ubuntu1 6.2+dfsg-0.1
2014-03-14 15:32:33 upgrade libudev0:i386 175-0ubuntu19 175-7.2
2014-03-14 15:32:40 upgrade libdevmapper-dev:i386 2:1.02.74-6ubuntu4 2:1.02.74-8
2014-03-14 15:32:42 upgrade libdevmapper-event1.02.1:i386 2:1.02.74-6ubuntu4 2:1.02.74-8
2014-03-14 15:32:43 upgrade libdevmapper1.02.1:i386 2:1.02.74-6ubuntu4 2:1.02.74-8
2014-03-14 15:32:44 upgrade dmsetup:i386 2:1.02.74-6ubuntu4 2:1.02.74-8


How can I get only the name of the packages by means of grep, awk or whatever tool?


More From » grep

 Answers
1

Try the below command,



awk ' { print $4 } ' upgradeddpkg > upgrade.txt


If you don't want the colon : then run,



awk -F ':' ' { print $1 } ' upgrade.txt > upgrade1.txt


Explanation:



awk ' { print $4 } ' upgradeddpkg > upgrade.txt


In this, awk takes the input from upgradeddpkg and prints only the $4(column number 4).That output was redirected to upgrade.txt file.So upgrade.txt file contains only the package names with colon.To remove the colon and its upcoming part(following), you have to run the second command.By default awk considers space as a delimiter.



awk -F ':' ' { print $1 } ' upgrade.txt > upgrade1.txt


Delimiter colon was manually set and awk considers colon as a delimiter instead of space.Now awk takes the input(stdin) from the upgrade.txt and prints(stdout) the coloumn1(part before the colon).Finally the standard output was redirected to upgrade1.txt.Now it contains only the package names.


[#26497] Saturday, May 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fulild

Total Points: 239
Total Questions: 103
Total Answers: 112

Location: Papua New Guinea
Member since Thu, Jul 9, 2020
4 Years ago
fulild questions
Sat, Dec 11, 21, 20:10, 2 Years ago
Thu, Jun 17, 21, 12:05, 3 Years ago
Sat, Nov 19, 22, 16:28, 2 Years ago
Sat, Feb 25, 23, 22:59, 1 Year ago
Wed, Oct 12, 22, 04:04, 2 Years ago
;