"sed" ("stream editor") is a Unix utility that parses and transforms text files.

learn more… | top users | synonyms

1
vote
2answers
41 views

use sed to replace a specific string with slashes

I have a big text file -a windows registry file- about 5.5MB and I have to remove a string "serv\b\Param\". Opening with gedit or nano doesn't work. It will either consume 100% cpu time for some ...
1
vote
2answers
351 views

netcat output into separate files using string delimiters

I want netcat to pipe the output of a tcp/ip connection to commands that examine the output and split it into distinct files separated by the strings "msg" and "/msg" from the output, something like ...
0
votes
2answers
19 views

how to retrive value between double quotes with multiple double quotes in line using sed

I am trying to use sed to retrieve value of 'identifier' from below line which is string 'TestStudioJobResponseMessages' in below example, also I don't want to use string uuid in my sed expression as ...
0
votes
2answers
220 views

How can I create a sed command line from diff?

I'm aware that diff -e can output an ed script. And my understanding is that ed and sed share their approach, but that ed is interactive, and sed is for streams. What I would like to do is take the ...
0
votes
2answers
113 views

Replace string in string but not when its somewhere between double square bracket

I have a long string from mysql field containing the data of a mediawiki page. I have to replace a string in that mediawiki page but not when the string is in mediawiki link. The mediawiki link is ...
0
votes
2answers
58 views

Including " in a regular expression using sed on windows

I have: echo finally came. 34^"This is the account of | sed "s:[1-9][0-9]["]:<a name=\"top\">&</a>:g" and I need to get finally came. <a name="top">34"</a>This is the ...
0
votes
2answers
192 views

split a textfile after each n matches to a new file using sed or awk

i tried to split a file in parts of n matches each. The file is just one line and the seperator is '<br>' foo<br>bar<br>.....<br> I just want to split the file in parts, ...
0
votes
2answers
108 views

Trying to get example from Awk and Sed book to work on Ubuntu 13.04

I have been developing Windows Software for years. I am trying to branch out and learn Linux. It will really help with my new job. I have picked up the book, "Awk and Sed" 2nd Edition. I am ...
-2
votes
2answers
84 views

Trying to count and print song file names using awk

RANK NAME BAND YEAR GENERE DOMESTIC/INTERNATIONAL 206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2 207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2 ...
3
votes
1answer
312 views

Replace special characters with set from Windows cmd

I need to replace the string "\\" (double quote backslash backslash double quote) with "" (double quote double quote). The following is an example of the data to be manipulated: ...
1
vote
1answer
113 views

How to replace a line in an xml file with a set of lines stored in a variable or file using unix commands?

I have a xml file in which the line that needs to be searched is: SEARCH='<?xml version="1.0" encoding="UTF-8" standalone="no"?><SSC>' This searched value needs to be replaced with ...
1
vote
1answer
27 views

Is it possible to sed -i from a text file to another text file?

I'm coding a shell script on my Debian box and there's a line on the script that needs to delete some emails from a textfile that is full of emails, like this: sed -i ...
1
vote
1answer
258 views

error occur when i run awk command write in .sh file and run in cygwin terminal

i have cygwin terminal for run shell script(.sh ) file...it work good..but when i add awk command in shell script and then run Error occur /usr/bin/gawk.exe: error while loading shared libraries: ...
1
vote
1answer
559 views

Find/replace underscored words to camelCase words using regex?

I have a ton of text files that are tagged with underscore-connected words like @some_text, but I would like to convert those to tags in camel case, like @someText. How can I use regex (either in vim ...
0
votes
1answer
45 views

Awk script to run a command based on condition using 'if'

I have a piece of code here that basically takes a file called 'srcip' (which is just a list of IP addresses) and compares it to my '~/db' file which is just a tab delimited IP HOSTNAME database of ...
0
votes
1answer
23 views

How do I search for and delete just the endings of list of directories using 'sed' command?

How do I use sed to delete just the '-bak' portion of the following list of directory names: accesscode-bak adminconsole-bak adoptimizer-bak ads-bak ahcms2-bak alerts-bak alfresco-bak
0
votes
1answer
36 views

Extract text between two slashes and add it at the end of the line after a tab character

I have a text file looking like this: data/CON/001/raw_series_ST_MC_REG_SM.nii data/PAT/001/raw_series_ST_MC_REG_SM.nii I would like to achieve something like this: ...
0
votes
1answer
25 views

Return / transform then return pattern with nulls

I'm using grep/sed to parse a large binary file full of nulls for some specific data. This is in a windows environment using gnuwin32. Assuming I had some to return some data from a binary file that ...
0
votes
1answer
37 views

Remove beginnings of email addresses from text using grep or sed

I have a text file with lines like the following: John Stevenson Johnnyboy34 john.stevenson@company.com 0320423\n Mike Anderson AndersMike mike@mikeltd.foo 0234234 How do I remove the "text" ...
0
votes
1answer
31 views

Bootstrap pkgsrc on macosx (10.9) error

I am trying to bootstrap pkgsrc-2014Q2 on OS X 10.9. The script complains: cd /Users/tiramo/Downloads/pkgsrc-2014Q2/bootstrap/work/wrk/pkgtools/bootstrap-mk-files/work/bootstrap-mk-files-20140516; ...
0
votes
1answer
30 views

How to use sed to examine the line without specific content?

I made a toy file named toy, its content is like: aaa bbb My first idea is to use: sed -n '/[^a]/ p' toy bbb it prints out bbb, but when I added bb ab to the end of toy file. I found it lose ...
0
votes
1answer
136 views

GnuWin32 sed how can I search and replace quotes? Win7 UK

Getting really weird behaviour with sed in Win7: Manual says surround substitute command with single quote (') - rejects, only allows double quote ("). Plus I want to change double quote in a file to ...
0
votes
1answer
80 views

SED: syntax error at script.pl line 19, near “;$'”

I am using this command to delete multiple occurrences of a line in my script and it just works fine when I run it on the command prompt. However when I use this line in my perl script it throws an ...
0
votes
1answer
295 views

sed exact match patterns of range and extract lines from thereon

I am trying to extract range from IP= to TUAL_HOSTNAME_=, as below. But its also extracting other match pattern for IP. sed -i -e '/IP=/,/TUAL_HOSTNAME_=/{w /tmp/101' -e 'd}' /tmp/install; #IP= ...
0
votes
1answer
80 views

How to encrypt the mail in unix?

I want to encrypt the mail as that will be containing the confidential information. There are no attachments. Please help in providing the steps to encrypt the mail. I have got the reference of How ...
0
votes
1answer
90 views

iterating bash script for cycle in a file

I try to make this very simple bash program that must make the following operations: modify a file java n times: every time I must change a single word in a single line of the file (the line is 11) ...
0
votes
1answer
39 views

SED basic substitutoin is not working

I am on ubuntu 12.04. Following expression: echo abcd123 | sed 's/\([a-z]*\).*/\1/' is supposed to get result as "abcd". But I am getting "abcd123". WHY?? Using following site as SED tutorial: ...
0
votes
1answer
82 views

trying to extract two tables at a time from http files with 40 tables each

I have about 20 webpages. Each page has top banner navigation and then has information on up to 20 vehicles. There are 2 tables per vehicle. The logical flow is: page navigation, table 1 for ...
0
votes
1answer
51 views

Need to iterate through a list of files and append text at the first line of the files in th list on a Linux CentOS system

I need to be able to append the text <?php to the beginning of php files in a list. Thank you in advanced for the help.
0
votes
1answer
84 views

Perl or Sed to remove a web virus

I recently ran across a bit of code injected to all of the files on a web site and I need to use perl or sed to remove it across all the files. I am having trouble coming up with the exact pattern ...
0
votes
1answer
375 views

Mass migration of EXIF GPS data (a.k.a. Escape from iPhoto)

I am trying to move my library of photos (over 12000) out of iPhoto for use in Adobe Lightroom and would like to include the GPS data I've added to the photos using iPhoto's in-app feature (This data ...
0
votes
1answer
307 views

Combining multiple data files with header while also adding a data column

I have multiple tab delimited data files that are separated by month in the format jan06.txt, feb06.txt, ..., dec07.txt. Within each file, it looks something like: Header1 Header2 Header3 ... Data1 ...
0
votes
1answer
618 views

replace long text with special characters with sed

I am using sed in unix to replace some text with special characters in a file. I google it and find the following command sed 's/from/to/g' file.txt here 'from' is the original text being replaced, ...
0
votes
1answer
127 views

how to get access to environment variables from output file

I want to get variables from a output file specific location,and input file format as below: log1.txt format: [v] Output Data ...
0
votes
1answer
329 views

Pattern matching gnmap fields with SED

I am testing the regex needed for creating field extraction with Splunk for nmap and think I might be close... Example full line: Host: 10.0.0.1 (host) Ports: 21/open|filtered/tcp//ftp///, ...
0
votes
1answer
841 views

Solaris bash script / search and append field to end of line in /etc/group

I need a bash script that will modify /etc/group to append and delete NIS users to specific local groups on a Solaris 10u8 system. Preferable one or two functions with uid and groupname as varibles. ...
0
votes
1answer
516 views

sed or grep or awk to match very very long lines

more file param1=" 1,deerfntjefnerjfntrjgntrjnvgrvgrtbvggfrjbntr*rfr4fv*frfftrjgtrignmtignmtyightygjn 2,3,4,5,6,7,8, ...
3
votes
0answers
39 views

Can I create a “file” that, when opened, actually gives the output of a command?

I've found myself in a couple of situations now where I'd like to have such a "file" that essentially runs a script whenever it's "opened", allowing me to "read" it's output. For example, I might ...
1
vote
0answers
114 views

sed without regex

I am using GNU SED for find and replace functionality on large files(upto 2GB). Find and replace characters can contain any characters, hence I want find and replace parameters to be treated as plain ...
0
votes
0answers
7 views

Why does sed accept \s (only when not in a character group)?

Okay, so I have always used \s to match whitespace but now I have been having a bit of difficulty as with sed, while trying to do a negated character group match [^\s] I found this does not work. ...
0
votes
0answers
41 views

GnuWin32 / sed unexpected behavior in Powershell

I am using GnuWin32 tools on Windows Command Line/Powershell. What is see: 11:15 enlil D:\Users\x> Get-ChildItem .gitconfig | sed "s/ */ /g" D i r e c t o r y : D : \ U s e r s \ x M o d ...
0
votes
0answers
61 views

how to show battery percentage on gnu screen hardstatus line

I currently have this as my hardstatus last line on gnu-screen the ~/.screenrc entry is as follows (just incase someone want something similar) hardstatus alwayslastline '%{= g}[ %{G}%H %{g}][%= ...
0
votes
0answers
13 views

Sed :cant read scripts/MIRRC.in: No such file or directory

I'm trying to install miriad and while entering sed -e "s,@MIRROT@,$MIR,"scripts/MIRRC.in &gt; MIRRC " I get the error below sed: Can't read scripts/MIRRC.in : No such file or directory I'm ...
0
votes
0answers
28 views

binary substitution in (audio)streams with bbe or sed

I try to do some stream manipulation with webradio streams. Goal is to use a pattern in triggerfile to substitute some seconds of the instream to silence in the outstream I found bbe to possibly fit ...
0
votes
0answers
19 views

How to colorize the output using sed - no GNU tools available

I'm using a short alias in my .profile file to colorize the output of the sdiff command, just to make it easier to spot differences. The alias is like this: alias color_diff="sed 's/[|< |> ...
0
votes
0answers
35 views

How to call “sed” on PDF files

I am able to find text on PDF files using pdfgrep. How can I sed them? I just want to change a pattern of text and I don't think I need a editor for that. Or do I? How can I achieve that?
0
votes
0answers
32 views

Seperate one data file into 2 files

I would like to seperate 1 file into 2 or 3 files. (Normally I open .txt file, check second column and first, if it has different numbers and copy that data to Input a.txt:) ...
0
votes
0answers
351 views

find and replace in PDF using sed and pdftk

I am doing a mass find and replace using sed and pdftk to find and replace a word in PDF files. When I run the following command, sed -e "s/word1/word2/g" test.pdf I get the following error, sed: ...
0
votes
0answers
53 views

How do I script a config file change

I'm trying to create a script to make the vi color change described here http://www.kavoir.com/2009/05/how-to-change-vim-syntax-highlighting-colors.html Trying to do it with sed but it's not working ...
0
votes
0answers
185 views

How can I improve or wrap my sed-script?

I instrumented a mvn build to emit profiling data, which I want to analyse later on. Therefore, I made the sed script below, to generate json-data from the profilers output. I call the script with ...