About String Handling

Asked

Viewed 53 times

1

I have a somewhat curious problem, perhaps a challenge.

I need to add to my database the list of all cities in Brazil, I found an SQL with all the way I need, however, the name of the SQL table meets with "quotes" as in the following example:

INSERT INTO `tb_cidades` VALUES (0001, 01, 'AC', 'Acrelandia');
INSERT INTO `tb_cidades` VALUES (0002, 01, 'AC', 'Assis Brasil');
INSERT INTO `tb_cidades` VALUES (0003, 01, 'AC', 'Brasileia');
INSERT INTO `tb_cidades` VALUES (0004, 01, 'AC', 'Bujari');
INSERT INTO `tb_cidades` VALUES (0005, 01, 'AC', 'Capixaba');

I wonder, how do I create a simple script or algorithm, to change the name 'tb_cities' to cities. I have the list of all, only in one file . txt

  • An replace/replace does not solve the problem?

  • You are using Linux?

  • 2

    Here has an sql with all the cities of Brazil

  • Like I said, rray I’m with the list in . txt, I don’t know how to manipulate there;

  • Giuliana Bezerra, yes

  • Every text editor has the search/replace function no need for script.

  • 2

    True, Gedit for example has find/replace, you could use it. The default to replace would be: tb_cidades -> cities.

  • 2

    Use any text editor.

  • 1

    I didn’t know about these functions of the text editors, I was able to solve my problem thanks to you. Thank you guys!

Show 4 more comments

1 answer

0


I had the same problem recently, I generated a script with the information inserted in my old Firebird database to add in Postgresql, but the date information came without the quotes, the solution that I suggested and worked was to use the Notepad++ and gave worked perfectly for me I believe it works for you too:

Link to my question

Browser other questions tagged

You are not signed in. Login or sign up in order to post.