Замените поле mysql на X

Python ( SPLIT.PY ):

import sys

# call with the file as parameter

base = 0
line = ''
with open(sys.argv[-1]) as fp:
    with open('shorter', 'w') as fps:
        with open('longer', 'w') as fpl:
            for x in fp:
                if line and x.startswith('>'):
                    print len(line), base
                    if (len(line) - base) >= 200:
                        fpl.write(line)
                    else:
                        fps.write(line)
                    line = x
                    base = len(x)  # lenght of the ">..." line
                    continue
                if x.startswith('>'):  # very first one
                    base = len(x)
                line += x
            if line:
                if len(line) >= 200:
                    fpl.write(line)
                else:
                    fps.write(line)
                line = ""

Вызов с Python Split.py IniteFile , а затем MV короче вводаFile (после проверки того, что файлы в порядке)

-2
28.05.2015, 17:55
1 ответ

Вы можете выполнить команду MySQL MySQL -E -E, как это:

$ mysql -u user -pPASSWORD -e 'UPDATE QUERY;'

из MAN MYSQL

--execute=statement, -e statement
Execute the statement and quit. The default output format is like that
produced with --batch. See Section 4.2.4, “Using Options on the
Command Line”, for some examples. With this option, mysql does not use
the history file.

дать пытаться!

Примечание: не рекомендуется поставить пароль в строке

2
28.01.2020, 05:16

Теги

Похожие вопросы