![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 | Thread Starter | Forum | Replies | Last Post |
| How to print data between 2 lines in a file | kamesh83 | UNIX for Advanced & Expert Users | 4 | 4 Weeks Ago 05:11 PM |
| Adding words to beginning of lines | Ernst | Shell Programming and Scripting | 9 | 04-03-2008 11:23 AM |
| Ignore some lines with specific words from file comparison | jakSun8 | Shell Programming and Scripting | 2 | 03-12-2008 09:11 PM |
| Delete lines that contain 3 or more words? | revax | Shell Programming and Scripting | 5 | 12-11-2007 03:33 PM |
| To split a string to obtain the words delimited by whitespaces | Sudhakar333 | Shell Programming and Scripting | 4 | 08-06-2007 11:26 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Grap data/string from lines between words
Hi all,
im newbie in unix, i have a case like this file name : RegisterSubscriber.log file value : <errId>0x0509000000000003</errId><HARs><ok/><affectEntity>510890905290059</affectEntity></HLRes></HRI> I want to grep the line which contain 0x0509000000000003, and i want to grep the word between <affectEntity></affectEntity> that is 510890905290059, can some one tell me how to doit, i try to use grep but all i got is the whole line please need your expert advice |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
echo '<errId>0x0509000000000003</errId><HARs><ok/><affectEntity>510890905290059</affectEntity></HLRes></HRI>' | sed 's#.*<affectEntity>\(.*\)</affectEntity>.*#\1#' |
|
#3
|
|||
|
|||
|
wow thanks, its works after i modify some of the code.
thanks |
|||
| Google The UNIX and Linux Forums |