Login
Search
Welcome to the iTechForums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 3
Members:
Number of Users Online:
Welcome to our newest member,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2008, 08:20 AM
ArnArn ArnArn is offline
Junior Member
 
Join Date: May 2008
Posts: 24
Default

perl command?


<?xml version="1.0" version="20080505">

I want to store "20080505" from the above line in an array or string and use it to replace a date in the next file. Can someone please help me what command to use???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-13-2008, 08:20 AM
Eric V Eric V is offline
Junior Member
 
Join Date: May 2008
Posts: 8
Default

First of all, are you sure you typed it correctly? if so, it is very poorly written xml - there can't be two attributes of the same name! perhaps you meant date="20080505" ? I will assume you did. If you didn't, and it is indeed a second 'version' attribute, let me know and i'll modify my answer.

#Say you have the string in a variable:
$string = "<?xml verion="1.0" date="20080505">;
#use regex string matching:
#returns true if it finds date, equals, quote, 8 digits, quote.
$string =~ /date=\"(\d{8})\"/
#what it matched in parentheses is contained in the $1 var:
$date = $1;


Now $date contains the string "20080505"
Let me know if this isn't what you needed, or if you need more help
-Eric
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-13-2008, 08:20 AM
Peter Peter is offline
Junior Member
 
Join Date: May 2008
Posts: 6
Default

It's not possible with XML.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
-f command does not work for my SSH - Unix.? Eylül UNIX 1 05-21-2008 07:44 PM
SQL Equivalent to MySQL's mysqldump command? dreamzdb MySQL 1 05-13-2008 08:18 AM
Javascript command line? drp2309s JavaScript 0 05-10-2008 01:35 PM
Help with system command in perl on windows? neverknew Perl 1 05-06-2008 08:49 PM
can't run this command on oracle help !!!!!!!? akademiks_98 Oracle 0 05-06-2008 12:40 PM

Your Ad Here

All times are GMT. The time now is 12:57 PM.