Difference between revisions of "Unix automation"
Jump to navigation
Jump to search
(Created page with "<div id="APB"> <div class="b1"> Automating tasks in Unix. </div> {{fix}} The unix command line provides an interpreted programming environment. Some things are easier to a...") |
m |
||
Line 22: | Line 22: | ||
| | ||
− | |||
+ | ==Shellscripts== | ||
+ | [...] | ||
− | ====Change extensions for many files | + | |
+ | ==cron== | ||
+ | [...] | ||
+ | |||
+ | |||
+ | ==Examples== | ||
+ | |||
+ | |||
+ | ===Change extensions for many files=== | ||
To change all <tt>.htm</tt> files in a folder to <tt>.html</tt> files: | To change all <tt>.htm</tt> files in a folder to <tt>.html</tt> files: | ||
Latest revision as of 02:12, 16 September 2012
Automating tasks in Unix.
The contents of this page has recently been imported from an older version of this Wiki. This page may contain outdated information, information that is irrelevant for this Wiki, information that needs to be differently structured, outdated syntax, and/or broken links. Use with caution!
The unix command line provides an interpreted programming environment. Some things are easier to achieve with a shell script than with a perl program. However, you can get everything done in perl that you can do in a shellscript and that saves you the need to learn yet another syntax.
Contents
Introductory reading
Shellscripts
[...]
cron
[...]
Examples
Change extensions for many files
To change all .htm files in a folder to .html files:
- using basename to extract the actual filename from a string...
- <bash>for f in *.htm; do mv $f `basename $f .htm`.html; done;</bash>
- or, using echo to pipe the filename into sed and applying a regular expression/substitution...
- <bash>for f in *.htm ; do mv $f `echo $f | sed 's/\(.*\.\)htm/\1html/'` ; done</bash>
Further reading and resources