Most voted "sed" questions
29 questions
Sort by count of
-
3
votes4
answers249
views -
2
votes2
answers522
viewsInsert string in first column
I am breaking my head with something very simple, I need to insert a ";" (point and comma) after a Sort/Uniq in a file. As it returns the number of repeated lines, I need this return that is always…
-
2
votes2
answers1499
viewsRemove all line breaks from just one column of a csv file on Linux
I have a file csv with more than 500k of lines and need to remove line breaks from just one column efficiently in addition to deleting all the links it contains, a snippet of the file:…
-
2
votes1
answer113
viewsHow to change Cartesian file coordinates in an automated way
I have a certain folder with several files, and these in turn contain inside description of coordinates points cartesian X and Y. However, I want to replace these points automatically and…
-
2
votes2
answers186
viewsUnexpected output when printing substring
I’m doing a file search in a given directory and printing its respective path. find ./ -exec sh -c "echo $(dirname "{}")" \; Output: ./algo/desse/tipo Since in some cases this path is a little big,…
-
2
votes1
answer26
viewsFilter two lines of the file at the same time show only the second?
I have the following fictional file: Location: Estado Title: Bahia Location: Estado Title: Pernanbuco Location: Estado Title: Alagoas Location: Cidade Title: Recife Location: Cidade Title: Barretos…
-
1
votes1
answer85
viewsDelete words from a file
I have a file CSV and I have this list of words here: https://gist.github.com/alopes/5358189 The archive CSV has 3 columns, Text, user.name and Class and has about 100K of rows. I need to delete…
-
1
votes1
answer62
viewsReplacement with sed
I have to replace some files and I’m not able to write an expression that works. I have this text at the beginning of each line: NF3-9-16S_S9_1456|M02255:210:000000000-B9K3P:1:1101:14397:18152…
-
1
votes2
answers841
viewsReplace "[" with [ using sed
I am trying to fix some formatting errors of a file and have as input: "[""teste""]" And I wanted to get an output like: ["teste"] I’ve tried this command but it makes me wrong: sed -i s/"["/[/g…
-
1
votes2
answers50
viewsAdd . html extension at the end of all links in multiple files (with Shell Script)
Hello. I have a lot of HTML files that have links in the following format: http://localhost:8080/tag:alguma_coisa and I need to add the extension .html to these links so that they stay like this:…
-
1
votes3
answers102
viewsLinux - Edit multiple files using another file as source
I have a file (list name.txt) with several names, one per line. I need to edit or remove all the names that are on listanome.txt of several other files With grep I think which files should be…
-
1
votes1
answer60
viewsHow could I replace a row of multiple txt files that would come from an output of ls -l?
What I’d like to do is more or less that: ls -l | xargs sed’s/regex of the pattern I want to replace/new data/g' for each output of ls, a replacement is done inside the file using sed. Can you do…
-
1
votes1
answer372
viewsHow to assign a variable the sed command with formatting? Shellscript
I’m having a problem making a program to exchange the first number for X, because even if it works, the variable does not receive the value permanently: VAR="oi 200 20 10" VAR= echo "$VAR" | sed -r…
-
1
votes1
answer38
viewsI need to delete the line that matches a word in the first file and also the second file in the sequence. How do I do?
I need to delete an entire line through a word that I will define and at the same time delete another line as well, but now it must be in another file that corresponds to the line of the first file.…
-
0
votes3
answers2121
viewsAdd line at the end of the file with the sed command
I am configuring a virtual machine to install JDK 7, Tomcat 7, Jboss EAP 7 and Postgresql. Follow the project on Github for anyone interested: cresol-enviroment-Vagrant. I’m at the part where you…
-
0
votes2
answers36
viewsRemoval of string in script
To edit this file and remove any incidence of [[*m as I edit sed? The incidences are marked in bold. sed’s/ [[*m//g' file The backup routine is still running on the server! The backup process began…
-
0
votes0
answers106
viewsHow to restrict the operation of some Android buttons
I’ve been trying a few days, some alternatives to lock the buttons of a tablet and then I need them back to work. I’ll show you some ways I’ve done and which one is operating in the best way…
-
0
votes2
answers830
viewsFilter number of characters with SED or grep
I have a file with strings I need at first filter for example only lines that has 5 characters And in a second moment filter only those that have at least 2 characters repeated together Example:…
-
0
votes1
answer64
viewsformatting sql command export with sed
I have exported a table from my database as follows: "1";"Boi Preto";"2000-02-29";"2";"Sol Nascente";"2009-10-01";"3";"Parque Belo";"2007-03-15";"4";"Pedras…
-
0
votes1
answer242
viewsTreat special characters
I am treating the CURL return with SED, but as the information I receive but sometimes has the character / causes an error in the SED syntax. TOKEN=$(curl --silent $URL | awk -F '"' '/content/…
-
0
votes1
answer648
viewsSed - delete text from a position until the beginning of the file
I have this command that erases from a position until the end of the file, but how to delete from this position to the beginning of the file? sed -i '/Enviar mailBlogThis/,$d' *.txt…
sedasked 6 years, 6 months ago Miguel Silva 491 -
0
votes1
answer1446
viewsFind and replace a text line within a sed file
I have a problem that seems simple but I have problem in the regular expression, I have a file in format ppd that contains settings of a printer installed in my sector, I need to change a row…
sedasked 6 years, 10 months ago Efrain Huerta Araujo 1 -
0
votes1
answer69
viewsEditing file with shell script links
I have a file with 130 links to download via wget, all files are with the listed links such as:…
-
0
votes3
answers73
viewsRemove specific line of files on linux
I need to remove a particular line in a file crontab ex: * * * * * root /home/linaro/funcao1.sh * * * * * root /home/linaro/funcao3.sh * * * * * root /home/linaro/funcao4.sh * * * * * root…
-
0
votes1
answer63
viewsSED on linux does not work
Good afternoon, I’m having trouble deleting a line in my crontab using sed. my line is this: 0 1 * * * root shutdown -r +1 my sed that doesn’t work: sed '/0 1 * * * root shutdown -r +1/g'…
sedasked 5 years, 11 months ago Jasar Orion 1,052 -
0
votes0
answers252
viewsWrite to a Shell Script file
I have a problem writing a line in a file using Shell Script. I’ve tried using sed and echo, but in both I don’t have the expected behavior. Using the sed: sed -i -e 'export…
-
0
votes2
answers60
viewsVariable via POST to sed
I’m with a Raspbian running on a Raspberry Pi3, I’m making a system on top of it that needs the person to choose the hostname typing it into a field. And to change the hostname from rasp I need to…
-
-1
votes1
answer42
viewsTaking the title of an HTML page with sed or awk
I have several HTML pages that I would like to get the title by using the sed or the awk. When I do with the sed it returns all the content of the page, not just the title. On the pages the title…
-
-2
votes1
answer91
viewshow to remove unnecessary commas using sed in the shell script?
I’m trying to create a script to automate a job I do. Everything was going well until I found this problem. When I use the sed, to remove a word from the string, the output shows 2 commas together,…