Sed is known as a Stream Editor in that it can carry out various filtering and/or transforming functions on standard input or on user specified files.

learn more… | top users | synonyms

1
vote
1answer
66 views

sed “Permission denied” and “No such file or directory” errors while building Clockwordmod

Whenever I execute the command build/tools/device/mkvendor.sh samsung_aegis2vzw /your/path/to/the/boot.img I get this as the output build/tools/device/mkvendor.sh: line 83: /sedcommand: ...
1
vote
3answers
133 views

How can we remove text from start to some particular selected word using sed command in linux

I have a simple query related to selection and replacing text in linux. For explaning question I am using sed command. I have following text. hello world, I am just simple text for display. Now ...
0
votes
0answers
27 views

sed fix for BusyBox - boot fail unable to mount LVM

BusyBox why u no vi?! Summary: Ubuntu 14.04 Server after upgrade first boot, only boots to BusyBox v1.21.1 initramfs with "gave up waiting for root device" due to missing /dev/mapper/xxx-root as ...
3
votes
1answer
161 views

Delete the whole line starting with a special character except for the first word

I have very recently started using linux and I am almost completely oblivious on sed commands. I need to edit a file that contains a bunch of long lines starting with the common character ">" and ...
1
vote
3answers
44 views

sed replace text containing new line

I have a bash script for installing a web server on my Ubuntu server. I'd like, in the /etc/apache2/apache2.conf, to replace #ServerRoot "/etc/apache2" # by #ServerRoot "/etc/apache2" ...
2
votes
1answer
44 views

Trying to use GNU Parallel with sed

Why does this line do nothing? I'm trying to run a "sed" command in parallel and it outputs nothing to "standard.txt" $Filetemp = the file I'm stream editing standard.txt = the file I'm outputting ...
0
votes
2answers
46 views

Regular expression

I have a code that is looking for a specific pattern in my log files. Usually it begins with Association ID = (This is what I am looking for in parenthesis). Now the code I have made so far is ...
6
votes
2answers
175 views

Piping with Moreutils ts

I have an incoming stream at a serial port, with new lines appearing about once per second wren@Raven:~$ cat /dev/ttyUSB0 A_Sensor1,B_22.00,C_50.00 A_Sensor1,B_22.00,C_50.00 ...
4
votes
2answers
215 views

What is the meaning of :a;$!N; in a sed command?

$ (echo hello; echo there) | sed ':a;$!N;s/\n/string/;ta' hellostringthere Above sed command replaces new line character with the string "string". But I don't know the meaning of ...
1
vote
2answers
98 views

Extract full link of a div element

I'm downloading episodes from a series, but I'm tired for joining in the site, copying the link and downloading it for each episode. First, I join in the site and I get the HTML code. The code is ...
0
votes
2answers
51 views

How this command works

i see this command on other forums as a question for registering "date -u +%V$(uname)|sha256sum|sed 's/\W//g'" i think it depends on the time of my PC witch change every second .. but the output ...
2
votes
2answers
127 views

How to use sed to substitute current date?

How do I use sed to substitute date by a word. I tried doing this: tmp=`date +%d` echo $tmp if [ $tmp -lt 10 ] then pat="d" echo $pat else pat="dd" echo $pat fi cal | ...
1
vote
3answers
78 views

Forming IPAddresses from Text file

I have a huge text file that contains IP addresses scrambled all over but not in one unit for example. So what the@192@ heck are you doing@168@ in my house @10@.you were not @16@ supposed to be ...
1
vote
3answers
343 views

Remove quotes around integers in a csv file

In a large (>1 gb) csv file I have something like "34432", "name", "0", "very long description" but instead of that I'd like to have 34432, "name", 0, "very long description". I was looking at ...
1
vote
1answer
134 views

How to copy a part of a line to another position

I have about 100 print statements in a file like this: printf("%f \n\n",row1.req_pnttime); I want to copy the variable name inside the string so that it becomes like this ...
0
votes
3answers
296 views

How do I replace content of XML file by using shell scripting sed command?

I have a config.xml file which shows: <userid>myUserId</userid> <password>myPass</password> How can I replace myUserId and myPass by using sed?
2
votes
1answer
250 views

using Sed to search and replace text in XML file

I have the following text in File.XML: <!--UpdateAccountGUIDs>UpdateAndExit</UpdateAccountGUIDs--> I would like to replace that with ...
4
votes
2answers
114 views

Using Regex Breaking a text on the last digit using linux tools like sed, or awk

I have the following list that I want to break on the digit. For example: From: 103Ru 103mRh 104 1041 To: 103 Ru 103 mRh 104 1041 I would like to use Regx with sed or maybe awk in order to ...
2
votes
1answer
44 views

Filtering a line with sed

I have a file with columns of the form number_number number columns of numbers I want to extract the columns beginning with particular numbers. I tried the following, but get nothing in output: ...
2
votes
5answers
256 views

Help to build this expression using sed

I have a text file and I need to get rid off the entire information just before the = symbol in each line, for example: The line: File 1515 = foo.txt needs to look like this: =foo.txt So, I had ...
3
votes
2answers
273 views

sed not found but already installed [closed]

I'm using Ubuntu 13.04. I'm trying to install ptxdist-2011.11.0 and when I run ./configure, it says it doesn't find a sed version: checking sed version... configure: error: we need at least GNU ...
1
vote
2answers
64 views

Help about sed command

A Linux textbook covering sed command gives me an example as follow: sed -e 's/\(<[^ ]*>\)\([ ]*\)\(<[^ ]*>\)/\3\2\1/g' GNU Linux is cool Linux GNU cool is but while I typing exactly ...
3
votes
2answers
152 views

How to make sed works with break lines from file?

I'm adapting this script to insert file's content into another file. This is what I have now: #!/bin/sh # Check if first and second parameters exist if [ ! -z "$2" ]; then STRING=$(cat $1) # ...
0
votes
1answer
33 views

Count length of letter string

I have a file that look like that (DNA sequence in fasta format): >sequence_name1 ATCGTGATNNNNNNNNAGTCGATCGGATTCT >sequence_name2 NNNNATGTNNATGTCCNNNNNNN I want to count the length of gaps, ...
0
votes
1answer
146 views

sed, grep, and awk file sorting

I'm trying to get all the files which have 'load' in their names from a directory. I'm trying to do: find -type f | sed -s 'load However, I recurrently receive an error sed: -e expression #1, char ...
0
votes
1answer
455 views

Bash script, cannote replace string in a file with escaped $ and &

I have creatd a shell script which takes a string as input. If the string contains '$' or '&', then I need to raplace those characters with '\$' and '\&'. I could done that with sed command. ...
0
votes
2answers
883 views

How to sed and replace string with a folder path

I am trying to write the following bash script: HOME_DIR=/opt/my_home find ./CONFIG -type f -exec sed -i "s/_HOME_DIR_/$_HOME_DIR/g" {} \; The line that I want to be changed in the files is this: ...
4
votes
1answer
452 views

Convert all letters to uppercase in all text files from a directory

I have a lot of text files (with .txt extension) in one directory in which I want to convert all letters to uppercase. How can I do this using the terminal? I've tried: sed -i 's/[A-Z]/[a-z]/g' ...
1
vote
1answer
297 views

what this command do ? ls /usr/bin | grep ”man” | sed ”s/man/###/”?

I have a question I want to know what this command do ls /usr/bin | grep ”man” | sed ”s/man/###/” I have use this command and show me everything with ###, but I dont know whats mean. I hope ...
1
vote
2answers
208 views

Remove all lines that start with a hash from a list

For a simple example say I have list file which has the following contents cat dog pig dog hat cat clap sing king ca cat hog plate plate one two three cat I then have a 'pattern' file. With the ...
0
votes
1answer
434 views

How to replace strings in file without regex?

I need to replace some strings in files (from command line) but I don't want to use sed -i because my string contains lots of funny characters which need to be correctly escaped. Is there a way to ...
1
vote
1answer
140 views

How to sed two words in a line and add before and after?

I was curious to know if there is a better way to sed two words and add a line before and after them. I learned how from grymoire but I wanted to know if there was a better way to do: #!/bin/sh ...
0
votes
2answers
110 views

sed problem with scripting

I am trying to run a script using sed i runing like this for et in 1 # 2 3 do if [ -d ET$et ]; then rm -rf ET$et; fi mkdir ET$et cd ET$et cp ...
-1
votes
2answers
98 views

Reading a file line by line

I have a file that looks like: @ATDGGSGDTSG NTCCCCC + nddhdhnadn @ATDGGSGDTSG NTCCCCC + nddhdhnadn Now its a repeating pattern of "4" lines and I every time want to print only the 2nd line i.e. the ...
0
votes
1answer
37 views

Formatting a file to use it with fortune in the terminal

I have a big text file with 'Terms' and its 'Definition' separated by spaces(variable). I want to use it in fortune cookie format. Current file format: **term1** this is my definition with ...
1
vote
1answer
206 views

How to use sed with this complex expression of special chars and ips?

How to use sed to replace for example this expression: connection = sqllite///keystone@10.10.10.51 with this expression connection = mysql://keystoneUser:keystonePass@10.10.10.51/keystone
1
vote
5answers
2k views

How to remove special 'M-BM-' character with sed

File: https://dl.dropboxusercontent.com/u/32919746/file I have file that was created by copying content from DOCX document with LibreOffice into text file. I have modified file with sed to remove ...
0
votes
2answers
170 views

How to get sed to substitute for all but one character

I have a statement of the form atPhysAddress[1][1.10.0.0.98] i would like to remove all details except for the first one in the second bracket, or whichever value falls there, how can i achieve ...
6
votes
3answers
11k views

Sed substitute through a sentence on multiple lines

I am new to using sed but I have been experimenting sed's s/..../..../ (substitute) to modify a full sentence if it's on one line but I am unaware an alternative solution on how to modify a sentence ...
3
votes
2answers
187 views

How to batch organize files?

I have a directory with gigabytes (about 8gb) of small individual files. I want to organize them into directories by date. The date it was created is part of the filename. Here is an example of a ...
0
votes
1answer
282 views

search and replace inconsistency between vim and sed

Using the Ubuntu 12.04 and vim 2.22.0, why inside the vim I shall use: :9s/\d\+/1/ to change first digit of the mentioned line to 1, but couldn't be able to use the same with sed as : sed -i ...
1
vote
2answers
2k views

sed command replace text with ' character

I have an very big sql file that I cant open in a gui editor. I need to replace the string 'user1'@'localhost' (note the ` character) by 'user2'@'localhost' but i am having troubles finding the ...
0
votes
1answer
38 views

Detecting the fault in my sed command

I am creating a command to replace all instances of ; f. to , (frequent). . So i wrote sed -i 's:;[:space:]f.:,[:space:](frequent).:g' with out any change then i wrote sed -i 's:; f.:, (frequent).:g' ...
2
votes
2answers
609 views

What is sed and what is it used for?

I've been seeing a lot of sed lately, and I find it to be a rather confusing command. The manpages weren't particularly helpful, but I do know that it can be used for parsing the output of other ...
1
vote
1answer
466 views

Tell sed to make changes but those starting with a specific string in 8th to last line

Here again with another problem with sed. As the title says, I want sed to change lines starting at the 8th line to the end, but only lines which start with <b>. I have code all ready and ...
1
vote
1answer
131 views

Change a string keeping some text as it is using sed

I have got another problem here with SED. I wanna add some text to a string but with out changing a particular word which varies with every line. Or wrap a code on a string keeping it as it is. ...
2
votes
1answer
968 views

Change specific lines using sed

I have a html file and i want to edit from 8th line till next to the last line i.e no changes to 1-7 and the last line with sed utility. Example: line 1 <i>some text<i> line 2 ...
2
votes
3answers
4k views

Print text between two XML tags

Consider the following excerpt from a large XML file: ... <serverName someKey="false" anotherKey="0.05" thirdKey="0.04"> <default>blah.blah.blah</default> <region ...
1
vote
1answer
94 views

sed does not work

I tried to use the sed command to do some text replacement, sed -i 's/port=\"8080\"/port="\8000\"' /opt/apache-tomcat-7.0.37/conf/server.xml But I meet this error: sed: -e expression #1, char 9: ...
4
votes
2answers
204 views

Print text file every three line start at 2nd line

I have done it with simple loop to count and print through.. How can I do it in bash scripting with program such as sed,awk ?