Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What does this command mean?

Status
Not open for further replies.

u24c02

Advanced Member level 1
Advanced Member level 1
Joined
May 8, 2012
Messages
404
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Visit site
Activity points
4,101
Hi.

What does this mean?

(uname -r | sed 's/\([0-9]*\. [0-9]*\. [0-9]*\).*/\1/'
 

uname -r: print the kernel released
sed: string editor, 's replaced....
 

Hi,
uname prints the system information, -r prints the kernel version. The sed operation above used in pipeline is replacing whatever is present after first 3 digits like 1.2.3.4.5 --> 1.2.3

so uname -r | sed 's/\([0-9]*\. [0-9]*\. [0-9]*\).*/\1/' is same as uname -r.


sed 's /\([0-9]*\. [0-9]*\. [0-9]*\).*/\1/'
| | | | |
| | Start of Search Pattern | end of replacement pattern
| | |end of search pattern and begin pattern to be replaced if search pattern is found
| Substitution
|
sed command

\([PATTERN]\) store the pattern in \1 variable.
\. escaping '.' character.
[0-9] --character set 0 to 9
[Pattern]* -- 0 or more occurrence of Pattern
.* -- 0 or more occurrence of any character.

Hope this helps!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top