Say you have a file (a print) and need to clean it up, remove weird control caracters: how do you do it?
First you look at an hex dump of the file with hexdump -C: then you take note of the control caracters and their hex code.
After that you simply replace them with blanks or strip them off, depending on taste or requirements.
In the end you put together a big for loop like the following:
for f in directory/* ; do
# replace control characters
perl -pi -e 's/[\x0b\x01\x0c]//g' $f;
dos2unix $f;
# remove empty lines or lines with only blanks
grep -v '^[ \t]*$' $f > tmp;
mv tmp $f;
unix2dos $f;
done
Tuesday, May 10, 2005
How to remove empty lines and weird characters from MANY files
Etichette:
linux tipstricks
Tuesday, May 03, 2005
Open source portals and my apps
Today I have just tried to deploy an application based on struts/tiles/securityfilter on the popular jetspeed portal.
It has not been easy: jetspeed definitely needs better docs, but in the end it worked. My application even picked up authentication credentials from the portal. In the end it took me about 4 hours just to deploy the application, starting from zero.
Open Source Rocks!
Etichette:
linux tipstricks
Monday, May 02, 2005
I am an hacker!
I have gone through this famous hacker checklist and I am positive: I am an hacker.
Next step: write it on my CV.
Etichette:
computer
Subscribe to:
Posts (Atom)
