2012-10-31

Today's Oneliner: Numbering Files

mkdir renamed
ls -1 *(.) | sort | awk '{ count++; printf "cp %s renamed/%04d\n",$1,count; }' | zsh
  1. get the list of files in the current directory
  2. sort the list with sort command by the required order: reversed, numeric, ignoring case, ...
  3. generate a shell script, and execute it.

2012-10-23

Disabling Auto-Indent for Current File

:setl noai nocin nosi inde=

Today's Oneliner

 % sudo emerge -uDN --keep-going @world

 * IMPORTANT: 7 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

Calculating dependencies \

!!! Problem resolving dependencies for net-nds/openldap from @selected
... done!

!!! The ebuild selected to satisfy "net-nds/openldap" has unmet requirements.
- net-nds/openldap-2.4.33::gentoo USE="berkdb crypt cxx ipv6 (multilib) ssl
  syslog tcpd -debug -experim
passwd"

  The following REQUIRED_USE flag constraints are unsatisfied:
    cxx? ( sasl )

(dependency required by "@selected" [set])
(dependency required by "@world" [argument])
 % sudo equery d net-nds/openldap
 * These packages depend on net-nds/openldap:
app-admin/sudo-1.8.6_p3 (ldap ? >=net-nds/openldap-2.1.30-r1)
app-crypt/gnupg-2.0.19 (ldap ? net-nds/openldap)
app-text/acroread-9.5.1-r1 (ldap ? net-nds/openldap)
dev-libs/apr-util-1.4.1 (ldap ? =net-nds/openldap-2*)
dev-libs/cyrus-sasl-2.1.25-r3 (openldap ? net-nds/openldap)
gnome-base/gconf-3.2.5 (ldap ? net-nds/openldap)
kde-base/kdepimlibs-4.9.2 (ldap ? net-nds/openldap)
net-misc/curl-7.26.0 (ldap ? net-nds/openldap)
net-misc/openssh-6.1_p1 (ldap ? net-nds/openldap)
 % sudo USE="-ldap" emerge -1 $(equery -C d net-nds/openldap | awk '{ print "="$1}')
...snip...
 % sudo emerge -c net-nds/openldap
 % sudo emerge -uDN --keep-going @world