Home » Posts filed under regex
Sed One-Liners
Diposkan oleh Unknown on Saturday, November 22, 2008
Compare Dmesg Output between boots
Diposkan oleh Unknown on Monday, June 16, 2008
First remove the timing information from the dmesg with a sed Regular expression:
cat dmesg.txt| sed -r s/'\[[ ]*[0-9]+[.][0-9]+\]'//g > dmesg-clean.txt
Of course you can skip this step if you care about the timing information.
Then compare two kernel boot dmesgs.
diff -y --left-column dmesg1.txt dmesg2.txt | less
And as a script:
#!/bin/bash
# published under GPL v. 3.0
# (c) 2008 linux-tipps.blogspot.com
cat "$1" | sed -r s/'\[[ ]*[0-9]+[.][0-9]+\]'//g > DMESGCOMPARE-${1}.txt
cat "$2" | sed -r s/'\[[ ]*[0-9]+[.][0-9]+\]'//g > DMESGCOMPARE-${2}.txt
diff -y --left-column DMESGCOMPARE-${1}.txt DMESGCOMPARE-${2}.txt | less
rm DMESGCOMPARE-${1}.txt DMESGCOMPARE-${2}.txt