PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Seems like a basic import
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Seems like a basic import

Réponse
 
LinkBack Outils de la discussion
Vieux 15/10/2007, 21h54   #1
Starke
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Seems like a basic import

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.

  Réponse avec citation
Vieux 15/10/2007, 22h29   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Seems like a basic import

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?


  Réponse avec citation
Vieux 15/10/2007, 23h08   #3
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Seems like a basic import

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)
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h09.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10247 seconds with 11 queries