Print out only last revision in list of patches

Contributor Icon Contributed by Michilimackinac Date Icon February 21, 2005  
Tag Icon Tagged: Solaris

This will print out a list of patches that omits earlier revs of the same patch. This can be useful to check if a system is at the same level as another (via a diff) system but possibly went through a different patch cycle and ended with different patches at lower revisions.



showrev -p | awk -F- ‘{hold0=$0; hold=$1; while (getline > 0) { if (hold!=$1) {print hold0; hold0=$0} if (hold=$1) hold0=$0 } }’

Previous recipe | Next recipe |
 
  • Anonymous
    This failed with an awk error on my Solaris 8 system.

    showrev -p | awk -F- '{hold0=$0; hold=$1; while (getline > 0) { if (hold!=$1) {print hold0; hold0=$0} if (hold=$1) hold0=$0 } }'

    Changing the 'awk' to 'nawk' resolved the issue.

    showrev -p | nawk -F- '{hold0=$0; hold=$1; while (getline > 0) { if (hold!=$1) {print hold0; hold0=$0} if (hold=$1) hold0=$0 } }'

    Thanks for the tip.
blog comments powered by Disqus