Top "Sed" questions

Sed (Stream EDitor) is a command line editor for POSIX environment.

How to pass a variable containing slashes to sed

How do you pass a variable containing slashes as a pattern to sed? For example, if I have the following …

regex bash sed
Concatenate in bash the output of two commands without newline character

What I need: Suppose I have two commands, A and B, each of which returns a single-line string (i.e., …

regex bash sed pipe concatenation
Count number of blank lines in a file

In count (non-blank) lines-of-code in bash they explain how to count the number of non-empty lines. But is there a …

unix sed grep text-files
Printing only the first field in a string

I have a date as 12/12/2013 14:32 I want to convert it into only 12/12/2013. The string can be 1/1/2013 12:32 or 1/10/2013 23:41 I need only …

unix sed awk field cut
Deleting the first two lines of a file using BASH or awk or sed or whatever

I'm trying to delete the first two lines of a file by just not printing it to another file. I'm …

bash awk sed lines
Insert newline (\n) using sed

I am trying to scrub some lists into a properly formatted CSV file for database import. My starting file, looks …

bash sed freebsd
How to remove double-quotes in jq output for parsing json files in bash?

I'm using jq to parse a JSON file as shown here. However, the results for string values contain the "double-quotes" …

bash awk sed jq
Swap two columns - awk, sed, python, perl

I've got data in a large file (280 columns wide, 7 million lines long!) and I need to swap the first two …

sed awk
Case-insensitive search and replace with sed

I'm trying to use SED to extract text from a log file. I can do a search-and-replace without too much …

macos replace sed case-insensitive
How to decode URL-encoded string in shell?

I have a file with a list of user-agents which are encoded. E.g.: Mozilla%2F5.0%20%28Macintosh%3B%20U%3B%20…

bash shell awk sed urldecode