#!/bin/bash usage() { echo "Usage" echo "llxdev-changelog newchangelog oldchangelog" } if [ $# -ne 2 ]; then usage exit 1 fi NEW=$1 OLD=$2 if [ ! -e "${1}" ]; then echo "El fichero de changelog nuevo no existe" exit 1 fi if [ ! -e "${2}" ]; then echo "El fichero de changelog viejo no existe" exit 1 fi INFO=$(head $2 -n1) PACKAGE=$(echo $INFO | cut -d " " -f1) VERSION=$(echo $INFO | cut -d " " -f2 | sed -e "s%^(\(.*\))$%\1%g") LASTVERSION='' for newversion in `cat $1 | sed -ne "/^[^[:blank:]]/p" | sed -e "s/.*(\(.*\)).*/\1/g"`; do dpkg --compare-versions $newversion gt $VERSION || if [ -z $LASTVERSION ]; then LASTVERSION="$newversion" ;fi done sed -i -e "/^[^[:blank:]].*($LASTVERSION)/,\$d" $1 cat $2 >> $1