Tagged Questions

How would I go about colorizing the output of tail with sed?
echo "`tput setaf 1`foo`tput op`" works as expected
echo "foo" | sed -e 's/(foo)/`tput setaf 1`\0`tput op`/g' however, does not.
What am ...

I need to find and replace some patterns in some files, but I need it to return 1 or something if a pattern is not found.
Can I do this with sed alone or do I need to check whether the pattern exists ...

I have a file, foo.txt, and a regexp I want to find in that file. Each time I find the regexp, I want to take a line from another file, bar.txt, and substitute it in for the regexp match I found in ...

I have a log-file where at the end of a series of lines you can see if this block is relevant.
Now I'm looking for a command like sed to delete de blocks ending with "Content-Length: 0" and beginning ...

I have input.txt tab-delimited text file around 30K lines, I would like to check each row (s1..s30K lines) for missing value (i.e blank space) and fill the missing value with zero value.See out.txt
...

So I've been using 'sed' on linux for a while, but have had a bit of difficulty trying to use it on OSX since 'POSIX sed' and 'GNU sed' have so many little differences. Currently I'm struggling with ...

I'm currently trying to modify an echoed string of alphanumeric characters by piping it to sed. The area I'm interested in modifying is a block of numbers, which I would like to make 8 characters long ...

The first line is variable ann hold quite complicated value. The reason I use the second line is because I don't want to change anything in the third line col1content. To change replacement, I just ...

Well, I think you can find dozens of questions on this platform how to pipe find output to sed, but I haven't found anything for the reverse direction so far. What I want to do is modify my input, and ...

I would like to use sed to search for the first part of a text file with consecutive lines with at least n non-space characters. I would like to print from the first of those lines to the end of the ...

I want to understand, how following sed command is working:
sed -nre "/jar$/ { x; d; }; /class$/ { x; p; }
Actually it is part of another command to find a particular class file from the given list ...

I have a text file with the following format:
keyword value
keyword value
...
Where keyword is a single word and value is everything else until the end of line. I want to read the file from a shell ...

How can I use AWK in the following situation?
I want to concatenate lines that start with the same column. Only the first column is kept after the join (in this case aaa, www, hhh).
The file may be ...