Archive for the ‘shell scripting’ Category

Want to know the IMAGE LABEL of my ISO file

Monday, January 18th, 2010

This is something not so easy to find on the internet, and once again Linux shows its immense power in the simplest way: CLI. Question: I have a .ISO file representing the image of a DVD and I want to know the LABEL of that DVD. Answer: Issue ...

Scripting Galore – The beauty of randomic sort

Thursday, December 31st, 2009

Although it could seem an oxymore, sort something in randomic order might be usefl sometimes. Give a look to the script below, which I’m writing here for future reference. #!/bin/bash # # This script creates a list of file or symbolic link to ...

Scripting Galore – Copy list of files from bigger repository into another location

Sunday, November 29th, 2009

I don't consider myself a script guru, but sometimes I like to create small pieces of bash code to ease operations on my linux box... and I guess it's good idea to note here some of the recent solutions I've found for later remembering. I'll try to comment them, so that ...

Bulk File Rename

Tuesday, March 24th, 2009

Situation: I have multiple files with extension .sh.modified and I need to rename them all into .sh extension. Solution: for file in *.sh.modified; do mv ${file} ${file%sh.modified}.sh; done

How to check for new files in a directory

Saturday, March 21st, 2009

Made this small script for this purpose… #!/bin/bash # # Script to check a directory and write in file the new files # since last check. # ...

Using variables in sed

Tuesday, March 10th, 2009

In a world of Perl, sed seems to be an archaic method of doing things reserved to the real brave geeks! But sometimes sed does perfectly fantastic job, like it did for me few minutes ago… with some caveats. My goal was to replace $i with the value ...

Scripting elegance: reading filenames containing spaces

Tuesday, February 3rd, 2009

You might need to do something with a list of files contained in a file… and maybe these file names include spaces, therefore using a standard for i in `cat filename` do echo $i done does not work ...