Archive for March 23rd, 2013

How to Fix E: Could not perform immediate configuration on ‘exim4-daemon-light’.

Saturday, March 23rd, 2013

If you get an error like:

E: Could not perform immediate configuration on 'exim4-daemon-light'. Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)

,
During installing Exim with aptitude or apt-get, i.e. # apt-get install exim4-daemon-light

or

# aptitude install exim4-daemon-light

This is due to some kind of mess with other mail server packages (sendmail or postfix) previously installed on the host and some mess with mail servers installed on system, to solve it remove all SMTP server packages sendmail / postfix / exim and then after being sure all SMTP packages are purged from system from clean install Exim light SMTP variant: # apt-get update
# apt-get -f install
# apt-get --purge remove sendmail sendmail-bin
# dpkg --force-all -r postfix
# dpkg --purge exim4-base
# dpkg --purge exim4-config
# dpkg --purge exim4-daemon-light
# apt-get update
# apt-get -f install
# apt-get install exim4-base exim4-config exim4-daemon-light

 

 

Linux: Delete empty lines from text file with sed, awk, grep and vim

Saturday, March 23rd, 2013

As a system administrator, sometimes is necessary to do basic plain text processing for various sysadmin tasks. One very common task I do to remove empty lines in file. There are plenty of ways to do it i.e. – with grep, sed, awk, bash, perl etc.

1. Deleting empty file lines with sed

The most standard way to do it is with sed, as sed was written to do in shell quick regexp. Here is how;

sed '/^\s*$/d' file_with_empty_lines.txt > output_no_empty_lines.txt

2. Deleting empty file lines with awk

It is less of writting with awk, but I always forget the syntax and thus I like more sed, anyways here is how with awk;

cat file_with_empty_lines.txt | awk 'NF' >
output_no_empty_lines.txt

3. Deleting empty lines with grep

Grep  regular expression can be used. Here is grep cmd to cut off empty lines from file;

grep -v '^\s*$' file_with_empty_lines.txt >
output_no_empty_lines.txt

4. Delete empty files with vi / vim text editor

Open vi / vim text editor

$ vim

Press Esc+: and if empty lines doesn't have empty space characters use command

g/^$/d

Whether, empty lines contain " " – space characters (which are not visible in most text editors), use vi cmd:
g/^ $/d