LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-01-2007, 08:39 PM   #1
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
sed inclusion/exclusion


If I have the following data:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<events timestamp="1178056694" min_date="1178053090" total="3218" offset="0" count="10">
 <digg date="1178056693" story="1896806" id="67943582" user="Sherwood411" status="upcoming" />
 <digg date="1178056692" story="1896170" id="67943580" user="OneHine" status="upcoming" />
 <digg date="1178056690" story="1896889" id="67943571" user="KingOfTheKings" status="upcoming" />
 <digg date="1178056689" story="1889485" id="67943567" user="allthebest" status="upcoming" />
 <digg date="1178056687" story="1894012" id="67943561" user="sepultura" status="upcoming" />
 <digg date="1178056686" story="1896706" id="67943555" user="positiveions" status="upcoming" />
 <digg date="1178056686" story="1896874" id="67943553" user="jschliesman" status="upcoming" />
 <digg date="1178056684" story="1896888" id="67943551" user="diggerdubai" status="upcoming" />
 <digg date="1178056682" story="1892396" id="67943545" user="tshlock" status="upcoming" />
 <digg date="1178056682" story="1892398" id="67943544" user="boivie" status="upcoming" />
</events>
using sed how do I strip away everything but the story number? I looked through tutorials and got this... sed -n '/story=\"/,/\"/p' but it doesn't work. SED NOOBIE
 
Old 05-01-2007, 09:38 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Have you tried something along the lines of the following:
Code:
sed -ne 's/^.*story=\"\([0-9]*\)\".*$/\1/p'
 
Old 05-01-2007, 09:42 PM   #3
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Original Poster
Rep: Reputation: 35
Quote:
Originally Posted by osor
Have you tried something along the lines of the following:
Code:
sed -ne 's/^.*story=\"\([0-9]*\)\".*$/\1/p'
Perfect!
Thanks a million!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dhcpd exclusion for gateway address humbletech99 Linux - Networking 3 12-22-2006 12:28 PM
pthreads and I/O mutual exclusion oulevon Programming 6 04-29-2006 09:33 PM
single IP exclusion from IPTABLES range ekrumm Linux - Security 6 12-09-2005 09:42 AM
BASH; exclusion list and cp TheLinuxDuck Programming 3 03-10-2005 01:59 PM
interrupts and mutual exclusion jwstric2 Programming 1 12-09-2004 03:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration