[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: No ifconfig



On Tue, Aug 15, 2017 at 06:24:42PM +0200, Pierre Frenkiel wrote:
> On Tue, 15 Aug 2017, Greg Wooledge wrote:
> 
> > ip -o link | awk -F": " '{print $2}'
> 
>   and even shorter:
>   ip -o link | cut -d : -f 2

They are not equivalent.  Yours leaves extra whitespace.

wooledg:~$ ip -o link | cut -d : -f 2 | hd
00000000  20 6c 6f 0a 20 65 74 68  30 0a                    | lo. eth0.|
0000000a
wooledg:~$ ip -o link | awk -F": " '{print $2}' | hd
00000000  6c 6f 0a 65 74 68 30 0a                           |lo.eth0.|
00000008

So, to use the output of yours, an additional step would be needed
(whitespace trimming).


Reply to: