From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 72048902 for ; Mon, 18 Jul 2016 15:39:47 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 18 Jul 2016 06:39:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,384,1464678000"; d="scan'208";a="848348019" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.12]) ([10.237.221.12]) by orsmga003.jf.intel.com with ESMTP; 18 Jul 2016 06:39:45 -0700 To: Thomas Monjalon , christian.ehrhardt@canonical.com References: <1468847463-107132-1-git-send-email-sergio.gonzalez.monroy@intel.com> <2323240.uRAlvIC4g0@xps13> Cc: dev@dpdk.org From: Sergio Gonzalez Monroy Message-ID: Date: Mon, 18 Jul 2016 14:39:44 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <2323240.uRAlvIC4g0@xps13> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] mk: fix FreeBSD build X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2016 13:39:47 -0000 On 18/07/2016 14:25, Thomas Monjalon wrote: > 2016-07-18 14:11, Sergio Gonzalez Monroy: >> The sed syntax of '0,/regexp/' is GNU specific and fails with >> non GNU sed in FreeBSD. >> >> To solve the issue we can use awk instead to remove duplicates. > Christian, an opinion please? Sorry, forgot to CC him. >> Fixes: b2063f104db7 ("mk: filter duplicate configuration entries") >> >> Signed-off-by: Sergio Gonzalez Monroy > [...] >> - for config in $$(grep -v "^#" $(RTE_OUTPUT)/.config_tmp | cut -d"=" -f1 | sort | uniq -d); do \ >> - while [ $$(grep "^$${config}=" $(RTE_OUTPUT)/.config_tmp -c ) -gt 1 ]; do \ >> - sed -i "0,/^$${config}=/{//d}" $(RTE_OUTPUT)/.config_tmp; \ >> - done; \ >> - done; \ >> + grep -v "^#" $(RTE_OUTPUT)/.config_tmp | awk -F'=' '{a[$$1]=$$0} END {for (i in a) print a[i]}' > $(RTE_OUTPUT)/.config_tmp2 ; \ >> + mv $(RTE_OUTPUT)/.config_tmp2 $(RTE_OUTPUT)/.config_tmp ; \ >> + rm -f $(RTE_OUTPUT)/.config_tmp2 ; \ > You can avoid creating/deleting the file .config_tmp2 by using a variable: > config=$(grep -v '^#' $(RTE_OUTPUT)/.config_tmp) > echo "$config" | awk ... > $(RTE_OUTPUT)/.config_tmp Sure. Sergio