cat /etc/squid/squid.conf| sed -e 's/^#.*//g' | sed -e ':r;N;s/\n$//g;br'
sed -e 's/^#.*//g'
strips any line beginning (
# and anything that follows after the hash.
sed -e ':r;N;s/\n$//g;br'
N) in register r,
\n$) with nothing
cat test | sed -s 's/\([a-zA-Z0-9]\)/\1 /g'
sed needs the grouping operators
Suppose we have a text file containing the following lines:
number 1 number 3
and that we want to insert
number 2 as the second line between
number 1 and
number 3, we would issue:
sed -i '2inumber 2' file.txt
where the parts of the fragments represent:
2the line number,
ifor the insert command, and
number 2the data that has to be inserted.
which will modify the file in-place such that the contents of the file after the insertion becomes:
number 1 number 2 number 3
To print out all the lines between
sed -n '5,10p' file.txt