Questions tagged [sed] (73)

3
answers

How to edit huge SQL file?

Hello! Planning to migrate a database from myisam to InnoDB by creating a dump of the current table and import with InnoDB instead of myisam. The problem is complicated by the fact that we have a table size of 50 GB, and when editing the dump file to this table with the command sed, the approximate time of the change of ...
Vaughn_Langworth asked April 9th 20 at 10:42
1
answer

As in the sed regular expression to define the number of characters?

This code works: echo -e "123\n45\n678" | sed -r-e 's/([0-9]+)/replace/g' But as soon as I specify the number of characters, the code doesn't work: echo -e "123\n45\n678" | sed -r-e 's/([0-9](2-3))/replacement/g' I need to find a complex lines to a certain mask, wherein some of the rows may differ from each other by mask o...
Talia asked April 8th 20 at 02:12
1
answer

How to delete all before a certain word in the file?

Hello! There is a file with contents such as: For is me my dir .... Test me file remove gants How to delete everything in it leaving only the word gants I wanted of course to have idempotency, Or using lineinfile, replace. Can't find the regular expression regex. Could you tell me,thanks
easton24 asked April 7th 20 at 16:43
2
answers

How to trim text in bash?

Hello. In General, I need to get the path to site-packages # /opt/anaconda/envs/py36/bin/python-m site sys.path = [ '/etc/systemd/system', '/opt/anaconda/envs/py36/lib/python36.zip', '/opt/anaconda/envs/py36/lib/python3.6', '/opt/anaconda/envs/py36/lib/python3.6/lib-dynload', '/opt/anaconda/envs/py36/lib/python3.6/site-pa...
lilyan asked April 7th 20 at 09:02
2
answers

How to replace a string using regular expression in SED?

Good afternoon. Necessary to make a mass replace string in files on the server. The string has the form:<?php .... include $_SERVER['DOCUMENT_ROOT'].'/file.php'; <--- this line .... ?> Need to replace: .... include $_SERVER['DOCUMENT_ROOT'].'/NEWfile.php'; include $_SERVER['DOCUMENT_ROOT'].'/file.php'; .... ...
Dorothea.Ledner asked April 4th 20 at 13:22
2
answers

How to make a subquery to a database using SED?

The task is simple you need to bring in a new line the name of the domain from the subquery to the database via the ID in the mail Watching the mail queue mailq|grep ^[A-F0-9] |cut-c 42-80| sort | uniq -c| sort-n2 web175@ks02.ru 5 web174@ks02.ru 6 web137@ks02.ru 8 web221@ks02.ru 10 web217@ks02.ru 27 web178@ks02.ru Let us le...
Natalia_Shields asked April 4th 20 at 13:03
2
answers

How to mass replace a symlink?

find /etc/nginx/bx -type l-name '*ks10.ks10.ru*' | sed -e 'p;s/ks10.ks10.EN/ks11.ks11.ru/g' | xargs -n2 mv Works rename the file but not the links in it, so I need to replace the link itself, how to do it ?
Leone_Anders asked April 1st 20 at 16:11
1
answer

How to write a sed regular season for?

There is a line which looks like: +CIPGSMLOC: 0,-74.956924,40.262470,2019/11/05,00:55:10 How using sed (important) take the coordinates to the command left: -74.956924,40.262470
kristin43 asked April 1st 20 at 16:04
1
answer

How to insert the value in the penultimate row of the range?

Hi, There is a file:[/text0] text1 = text2 * = [/text3] text4 = text5 * = You need to paste text, n = text n' before '* =' but after the '[/text0] How can I do that?
laila asked March 31st 20 at 16:11
1
answer

Sed search system contains "text", but not containing "."?

Hi, There is a file book.txt that contains entries like: text word.text Problem - you need to remove in the file only the row that contains text and not text and word.text. Can handle it without GNU sed?sed -i "/text =/d" /book.txt This example removes the text and word.text.
quentin asked March 31st 20 at 16:02