2
I have a "mega heavy" SQL file that doesn’t open in the sublime, nor in the notepad nor in gedit. I just need to delete the first line Use nome_database;
to be able to import via the mysql Workbench or command line on the terminal:
mysql -hmeu_servidor -uroot -psenha banconovo < path/meuarquivo.sql
.
The problem is that the name of the bank is different, so it is making a mistake, it does not find the base. Does anyone have an alternative to delete this line without opening the file?
Can be via script edit.sh
or via PHP edit.php
. Or any better suggestions...
"Mega heavy" gives how much in bytes?
– Bacco
he weighs 1.5GB... ta fuck. I got so from the customer.
– Ivan Ferrer
You can use a hexadecimal editor instead. Hxd is very good.
– Bacco
How do I do that?
– Ivan Ferrer
https://mh-nexus.de/en/hxd/ - make a backup before you try. It is suggested not to change the size of the strings. For example, if the name is shorter, complete with spaces outside the quotes. If it is longer, you need to do a little contortion...
– Bacco
I use linux... has a version for Ubuntu?
– Ivan Ferrer
This type of editor usually has to mount, I just won’t know the name of some for linux. If you have practice with the terminal, can do using text mode, even have more tools for it.
– Bacco
I haven’t tested with "vi" yet.
– Ivan Ferrer
For the record, if you ever need
vim
, has the:%!xxd
to enter hexa mode (currently vi is shortcut pro vim on almost all systems) - but I commented of curiosity, pq open with thevim
do not need to use hexa mode in this specific case, of course.– Bacco
try this on the terminal:
sed '1d' original.sql > modificado.sql
(manual http://linux.die.net/man/1sed)– Bacco
worked here, with the "vi", thank you!
– Ivan Ferrer