in reply to converting txt to csv and formatting
Hi,
..My problem is I have no idea how I would go about grabbing data into specific fields with the way the txt file is currently formatted...
I really don't think that is such a problem. With the data set you provided, one can do like this:
Outputuse warnings; use strict; print join ("\t\t" => qw(Name Phone E-mail)),$/; while (<DATA>) { chomp; print $_, "\t"; print $/ if $. % 3 == 0; # note here } __DATA__ Jacobs, April 750.467.9582 quam.quis@sedhendrerit.org Mays, Martena 870.348.1974 sollicitudin@nonummyFusce.org McNeil, Brennan 289.527.6151 lobortis@nisl.com Sexton, Melvin 599.927.5337 in.felis@varius.com Blackburn, Prescott 661.589.1228 sed@egetlaoreetposuere.edu
The CSV part ( since you have mentioned that you can't use an external module ) and format to taste of the question is left for the OP.Name Phone E-mail Jacobs, April 750.467.9582 quam.quis@sedhendrerit.org Mays, Martena 870.348.1974 sollicitudin@nonummyFusce.org McNeil, Brennan 289.527.6151 lobortis@nisl.com Sexton, Melvin 599.927.5337 in.felis@varius.com Blackburn, Prescott 661.589.1228 sed@egetlaoreetposuere.edu
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: converting txt to csv and formatting
by csorrentini (Acolyte) on Jul 06, 2014 at 01:49 UTC | |
by 2teez (Vicar) on Jul 06, 2014 at 02:02 UTC | |
by csorrentini (Acolyte) on Jul 06, 2014 at 02:16 UTC | |
by Jim (Curate) on Jul 06, 2014 at 02:42 UTC |