- // the lines from which will be read
- $lines = "1
- 5
- 16
- 26";
- // split these numbers above into an array
- $lines = explode(PHP_EOL, $lines);
- // the source file where the ranges will be taken off
- $file = file('file.txt');
- for($i = 0; $i < count($lines); $i+=2) {
- $rangeStart = $lines[$i];
- $rangeLength = $lines[$i+1] - $lines[$i];
- // slice out the ranges, beware the second parameter is the length not the offset!
- $ranges[] = array_slice($file, $rangeStart, $rangeLength);
- }
- print_r($ranges);
- // the lines from which will be read
- $lines = "1
- 5
- 16
- 26";
- // split these numbers above into an array
- $lines = explode(PHP_EOL, $lines);
- // the source file where the ranges will be taken off
- $file = file('file.txt');
- for($i = 0; $i < count($lines); $i+=2) {
- $rangeStart = $lines[$i];
- $rangeLength = $lines[$i+1] - $lines[$i];
- // slice out the ranges, beware the second parameter is the length not the offset!
- $ranges[] = array_slice($file, $rangeStart, $rangeLength);
- }
- print_r($ranges);
- // the lines from which will be read
- $lines = "1
- 5
- 16
- 26";
- // split these numbers above into an array
- $lines = explode(PHP_EOL, $lines);
- // the source file where the ranges will be taken off
- $file = file('file.txt');
- for($i = 0; $i < count($lines); $i+=2) {
- $rangeStart = $lines[$i];
- $rangeLength = $lines[$i+1] - $lines[$i];
- // slice out the ranges, beware the second parameter is the length not the offset!
- $ranges[] = array_slice($file, $rangeStart, $rangeLength);
- }
- print_r($ranges);
- // the lines from which will be read
- $lines = "1
- 5
- 16
- 26";
- // split these numbers above into an array
- $lines = explode(PHP_EOL, $lines);
- // the source file where the ranges will be taken off
- $file = file('file.txt');
- for($i = 0; $i < count($lines); $i+=2) {
- $rangeStart = $lines[$i];
- $rangeLength = $lines[$i+1] - $lines[$i];
- // slice out the ranges, beware the second parameter is the length not the offset!
- $ranges[] = array_slice($file, $rangeStart, $rangeLength);
- }
- print_r($ranges);
- $file = file('file.txt');
- $len = count($file);
- $output = array();
- $current = array();
- for($i = 0; $i < $len; $i++) {
- $data = trim($file[$i]);
- if ($data != 'BREAK') {
- $current[] = $data;
- } else {
- $output[] = implode(PHP_EOL, $current);
- $current = array();
- }
- }
- print_r($output);
Tuesday, 31 July 2012
Creating files based on the line number for printing
Subscribe to:
Post Comments (Atom)
Popular Posts
-
File name: Ashli Orion and Georgia Jones part2.wmv Size: 188.90 MB Type: .wmv Source: http://w...
-
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JF...
-
Warning: This story contains fluffies, violence and human tragedy. Viewer discretion is advised. I don't even like c...
-
CheckBox chb = new CheckBox(); chb.InputAttributes.Add("value", "my_id_00"); chb.Text = "Title 00"; ...
-
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Point; import ja...
-
HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://simonexxx.no-ip.info/ilMercatinoDelxxx/Mod...
-
http://ul.to/so1xzfnd/Various Artists - Who Owns the Game? [iTunes Plus AAC M4A].rar http://imgchili.com/show/13303/13303501_who...
-
// the lines from which will be read $lines = "1 5 16 26"; // split these numbers above into an array $lines...
-
"30 Meters " + raw("²") def area_conversion(feet, project) if project.metric ...
-
private void Save_Click(object sender, EventArgs e) { string filePath = txtFilePath.Text; if (!Fi...
No comments:
Post a Comment