rename the file


Posted on 16th Feb 2014 07:03 pm by admin

File.txt

Code: ***DOCUMENT***
..DN:
Did you know?Explore Trending and Topic pages for more stories like this.
000044255
..CB:
..SN:
..PY:
2009
..ED:
LA
..ED:
Home
..ID:
***DOCUMENT***
..DN:
000044254
..CB:
..SN:
..PY:
2009
..ED:
LA
..ED:
Edition
..PT:
ID:

Code: <?php
$file = fopen($argv[1], "r") or exit("Unable to open file!");
$i=1000;
while(!feof($file)){
while(!feof($file))
{
$line=fgets($file);
if(strstr($line,"***DOCUMENT")){

$file1 = fopen($argv[1].$i.".txt",'w') or exit("Unable to open file!");
}
fwrite($file1,$line);
if(strstr($line,'..ID:')){
fclose($file1);
break;
}
}
$i++;
}
fclose($file);
?>


Hi,

This is the above file. I have splitted this file naming starting with 1000.txt.....
How to name taking the value of ED.
I have to name it as 1000.Home.txt
1001.Edition.txt
No comments posted yet

Your Answer:

Login to answer
78 Like 48 Dislike
Previous forums Next forums
Other forums

get the country of visitor and display content based on that
Hello all,

I have seen that Google analytics can tell you where a visitor is coming from and

Warning: session_start() [function.session-start]: Cann.....
hi, can someone help me with this? I keep getting this error....

Warning: session_start() [fu

IF Statement & Two Tables With Different Echoes
I'm retrieving two tables in a single query using UNION ALL, like so:

Code: $query = "SE

BIG file upload!
Hey guys!

I'm trying to upload a file, it works well with smaller files but with 60mb+, I get

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

TabControl Inside ListView Not Editing
Hello everybodyI have a ListView on my page. Inside the ListView I put a TabControl, cuz I want to p

Function to extract email attachments using PHP IMAP
function extract_attachments($connection, $message_number) {

$attachments = array();

Problem with a select distinct
I have a problema with a select distinct, I have the next sql:

select distinct a,b,c,d fr

Images in email problem
I found this script for sending emails, it works but if the email has <img src="image.jp

Find current logon time
Hi,
in my sql script i want to query and find out the logon time of the current session.
<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash