1

I'm trying to retrieve the distro name from the lsb_release -i output, but using

lsb_release -i | sed 's/Distributor ID: //g' 

won't do the trick.

What am I doing wrong? Or maybe should I change the tool?

1
  • I don't know lsb_release and it's not installed on my system. Can you please show us the output of the command before you pipe it into sed? Commented Feb 18, 2013 at 9:22

3 Answers 3

8

You do not have to manipulate the output if you add the -s or --short option which according to the help "show requested information in short format".

lsb_release -is 
2

The character after the colon is a tab, not a space. Use

s/Distributor ID:\t// 

The /g is not needed because the pattern is not repeated on the line.

You can also use much simpler

lsb_release -i | cut -f2- 
0
1

Try this:

lsb_release -is 

Per the man page of lsb_release(1):

 -s, --short Use the short output format for any information displayed. This format omits the leading header(s). 

On my machine:

bburns@bjb-laptop:~$ lsb_release -is Ubuntu 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.