• Get the Flash Player to see the slideshow.
  • Categories

  • Authors

  • Great Quotes

    It always seems impossible until its done. — Nelson Mandela

Get in touch...

To have a chat about
your CMS needs...

Call us 0207 193 2014
or
Email us on

Archive for the ‘Magic One Liners’ Category

XSL Extract File Suffix, Convert to Uppercase, Display

Monday, March 2nd, 2009
<xsl:value-of
select="translate(substring-after(/Properties/Data/Datum[@Name='filename'],'.'),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>

Change a word in many files

Saturday, September 27th, 2008

The below one liner will open all files in its path and change the word ‘MOO’ in any of the files to the word ‘BOO’.

find . -type f | xargs /usr/iw-home/iw-perl/bin/iwperl -i -p -e 's/MOO/BOO/g;'

This script has only been lightly tested so please make a backup of your files before running this!

Find all files of a type and count the size together

Tuesday, September 23rd, 2008

This wonderful little tool written by Richard Aldridge uses ’sed’ to group together all the files under a particular folder of a certain type (in the example this is files whose name contains the string ‘local’ but you could easily change this to look for other groups of files such as ‘.log’ or ‘.html’ files) and then adds all their sizes up to give a total number of kb the files amount too.

find . -name '*local*' -ls | awk 'BEGIN {$count=0} /./ {$count += $7} END {print $count}'

Perl Magic One Liners

Wednesday, July 2nd, 2008

This page is dedicated to all the quick one line utilities that are useful when managing an
Interwoven system or any other system that uses many files.

Find all files without metadata of content_type:

find . -name '*.xml' -exec /iw-home/iw-perl/bin/iwperl -e
'$file=shift;system("/iw-home/bin/iwextattr", -g=&gt;
"TeamSite/Metadata/content_type", $file);warn "$file\n"
if $?' {} ';' &gt;/dev/null

Regenerate Recursively

find . -name \*.xml -exec iwregen {} ';'

Check Socket Connection

This is useful to see if firewall is open when debugging OpenDeploy
(Thanks to Steve Martina for this one back in 2001):

/iw-home/iw-perl/bin/iwperl -MIO::Socket -e "$s=new IO::Socket::INET
(PeerAddr=&gt;'localhost',PeerPort=&gt;80,Proto=&gt;'tcp'); print $s?'OK':'fail'"

List the deleted but unsubmitted files in an area (. current dir)

/iw-home/bin/iwlistmod . | grep x+