Angharad has asked for the wisdom of the Perl Monks concerning the following question:
And so on. This text file was produced from 120 smaller .csv files, as you can probably guess from the names .. lol. What I need to do is to save each individual 'block' of numeric values .. for examplefilename = without012.csv pred = -0.0105 0.0645 0.1989 0.0151 0.0289 0.0400 0.5313 filename = without013.csv pred = -0.0080 0.0663 0.1911 0.0075 0.0288 0.0302 0.5234 filename = without014.csv pred = -0.0023 0.0595 0.2582 0.0323 0.0285 0.0578 0.5807
Into separate files, with each file being saved according to the smaller files from which these results originate. So, for the example below-0.0023 0.0595 0.2582 0.0323 0.0285 0.0578 0.5807
I would like to save the numeric block in a small file called without014.csv.filename = without014.csv pred = -0.0023 0.0595 0.2582 0.0323 0.0285 0.0578 0.5807
I was hoping that it would print out just the file names initially and then I was going to use the same technique for extracting the numeric block but all I am getting is blank lines when I run it (and yes, I'm checking that I am attempting to print off 'the right line' lol).#!/usr/bin/perl @file = <>; for($i = 0; $i < @file; $i+4) { print "$file[$i]"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extracting data and saving into seperate files
by wfsp (Abbot) on Jan 09, 2006 at 12:15 UTC | |
|
Re: extracting data and saving into seperate files
by pKai (Priest) on Jan 09, 2006 at 12:55 UTC | |
|
Re: extracting data and saving into seperate files
by explorer (Chaplain) on Jan 09, 2006 at 12:49 UTC | |
by pKai (Priest) on Jan 09, 2006 at 13:39 UTC | |
|
Re: extracting data and saving into seperate files
by radiantmatrix (Parson) on Jan 09, 2006 at 22:16 UTC | |
|
Re: extracting data and saving into seperate files
by Anonymous Monk on Jan 09, 2006 at 15:26 UTC | |
|
Re: extracting data and saving into seperate files
by Happy-the-monk (Canon) on Jan 09, 2006 at 11:50 UTC | |
by blazar (Canon) on Jan 09, 2006 at 13:45 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |