|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Extracting substring between pattern only one time
Hello ifconfig return : eth0 Link encap:Ethernet HWaddr 11:24:1D:C1:99:BA inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:37307 errors:0 dropped:0 overruns:0 frame:0 TX packets:27319 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:31305813 (29.8 Mb) TX bytes:2229012 (2.1 Mb) Interrupt:43 Base address:0x4000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:164 errors:0 dropped:0 overruns:0 frame:0 TX packets:164 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:20420 (19.9 Kb) TX bytes:20420 (19.9 Kb) I would like somethings like Code:
ADRESSE=$(ifconfig | sed -n '/addr:/,/Bcast:/p') echo $ADRESSE 192.168.0.1 Help would be appreciated |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
$ /sbin/ifconfig lan | awk '/inet addr:/ { print substr($2, 6)}'
192.168.0.126
$ |
| The Following User Says Thank You to Corona688 For This Useful Post: | ||
jcdole (07-05-2012) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
Thank you very much |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extracting substring | shyamu544 | Shell Programming and Scripting | 5 | 05-20-2011 08:03 PM |
| Extracting a substring from a string in unix | arunkumarmc | Shell Programming and Scripting | 19 | 05-21-2010 08:32 AM |
| Extracting substring from string | sdosanjh | Shell Programming and Scripting | 6 | 04-20-2010 12:28 AM |
| Extracting substring using ${var:start:len} | Raamc | UNIX for Dummies Questions & Answers | 3 | 06-05-2009 02:37 AM |
| extracting substring from a file name | adityamahi | Shell Programming and Scripting | 4 | 12-30-2008 10:07 AM |
|
|