Sed stands for Stream EDitor. It is one of the basic tools in the POSIX environment - it processes one or more files according to an editing script and writes the results to standard output. Created in Bell Labs, it has been around since mid-70s.

learn more… | top users | synonyms

3
votes
1answer
34 views

Removing ASCII “frame” around text

I sometimes save nice fortune outputs to my Evernote. The data looks like this: ...
4
votes
2answers
105 views

Using sed regular expression to extract domain name from file

I'm learning regex with sed to extract the last field from file named "test". The method I'm trying gives desired output. Please suggest if this method Im trying is ...
3
votes
1answer
44 views

Remove line numbers from shell history

I want to parse Linux history output and the commands parts only (without numbers): ...
3
votes
2answers
30 views

Changing filename and copying in bash

I wrote a script which changes names of last downloaded songs and copy them to music directory. Can it be written better? ...
1
vote
1answer
40 views

Parsing logs in sed efficiently

I have an application which log file has most lines start with a time/date, followed by a debugging level and the actual log message. Often I want to watch the output live and colors make it a lot ...
3
votes
1answer
67 views

Changing cuts to sed for parsing dates from apache log (common log file)

Would switching my cuts below to SED improve performance? I am trying to get a per date count of requests for the last two weeks from a server log. The script runs, but slowly (comes in around 14 ...
3
votes
1answer
126 views

Using sed to implement the cp command

I have a script for school that mimics the cp command. Part of the assignment is to modify the script so that the while loop (that assigns ...
4
votes
1answer
76 views

Find-grep-sed for project-wide search & replace

I always forget how to do this efficiently with Vim's arglist. Drawing inspiration from a post over at Stack Overflow, I wrote a Bash function to perform a project-wide search & replace. It does ...
6
votes
1answer
75 views

Bash script to convert NIST vectors to debug scripts

TL;DR: The Bash script (below) is converting a published, somewhat-structured text file into a format usable by my testing infrastructure. It's slow, I think it's ugly -- although it is fully ...
3
votes
1answer
47 views

Extracting performance statistics from FTP session transcript

I've borrowed and written the following code to output the disconnect time. All works well but I'm curious as to how I could tighten/ shorten the code. If anyone feels like having some fun then I'd ...
4
votes
1answer
2k views

Bash Shell Script uses Sed to create and insert multiple lines after a particular line in an existing file

This code seems to work, but I'd like someone with shell-fu to review it. Is the temp file a good idea? How would I do without? Is sed the right tool? Any other general advice for improving my ...
1
vote
1answer
174 views

Parsing of a file using sed

I have a file containing lines having this structure : ...
1
vote
2answers
180 views

Add getters and setters to a set of variables [closed]

Any improvements are welcome. a.bat ...
2
votes
2answers
677 views

Adding a zero to file names

I've recently discovered the power of sed; regular expressions seem like they'll take a lifetime to master. This tiny script uses both to add a zero before the single digit in file names. Can this be ...
4
votes
1answer
414 views

Transpose a matrix using sed

I'm trying to transpose the following data from: ...