Re: TXT files with fixed width

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



oliveira.pedro@netcabo.pt (Pedro Oliveira) writes:
> I need to import a fixed width txt to a my sql database, I
> know how to do that with a coma separated value.
> any1 knows how i can do this easilly or know some software to do this?
> any help would be appreciated.

*nix or windows? If the file is tab separated, I guess you can use
excel or something and export it to comma separated. On *nix, you have
an abundance of utilities, e.g. tr(1).

When you say fixed width, I guess it's not tab separated, however,
maybe:

# 345678901234567890123456789012345678901234567890
word1    word2     word3     someword4 another5

or something like that. Then you can e.g. use perl (or for that sake
PHP) and the substr function to parse the data and spit them out
either in sql, directly into the database or comma separated (or in
whichever format you desire).


-- 
--Fredrik
Subtlety is the art of saying what you think and getting out of the way
before it is understood.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux