|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
As the title says, this seems to be easy, but I can't get it to work.
Is there a way to get the below lines imported into MySql, or even access for that matter into seperate columns with no delimiter? Take for example the below lines 1:1 This is the first line 1:12 This is the second line. 31:1 this is the third line 32:12 this is the 4th line I would like for the following to happen on import first digit or 2 or 3 depending ont he number before the ':' then accept into first column, ignore the ':' take the next 1 digit or 2 possible 3 if exist into the next column in the db and skip the space and accept all the next digits into the next database column. can't seem to get anything to work cleanly. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Starke wrote:
> As the title says, this seems to be easy, but I can't get it to work. > Is there a way to get the below lines imported into MySql, or even > access for that matter into seperate columns with no delimiter? > > Take for example the below lines > > 1:1 This is the first line > 1:12 This is the second line. > 31:1 this is the third line > 32:12 this is the 4th line > > I would like for the following to happen on import first digit or 2 or > 3 depending ont he number before the ':' then accept into first > column, ignore the ':' take the next 1 digit or 2 possible 3 if exist > into the next column in the db and skip the space and accept all the > next digits into the next database column. > > can't seem to get anything to work cleanly. What tool are you trying to use to accomplish this? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mon, 15 Oct 2007 12:54:50 -0700, Starke
<starke1120@hotmail.com> wrote: >As the title says, this seems to be easy, but I can't get it to work. >Is there a way to get the below lines imported into MySql, or even >access for that matter into seperate columns with no delimiter? > >Take for example the below lines > >1:1 This is the first line >1:12 This is the second line. >31:1 this is the third line >32:12 this is the 4th line > >I would like for the following to happen on import first digit or 2 or >3 depending ont he number before the ':' then accept into first >column, ignore the ':' take the next 1 digit or 2 possible 3 if exist >into the next column in the db and skip the space and accept all the >next digits into the next database column. > >can't seem to get anything to work cleanly. Use awk to generate INSERT statements from your data, and pipe it into the mysql command line tool: awk -f your.awk yourdata | mysql -u uid -ppsw database awk is ideal (and easier to understand than sed) for this kind of preprocessing. -- ( Kees ) c[_] Giving power and money to government is like giving whiskey and car-keys to teenage boys. (PJ O'Rourke) (#291) |
|
![]() |
| Outils de la discussion | |
|
|