03-26-2013
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
:confused: How can i rename a file 'x.log' to 'x_20020512 072909.log'
:eek: i'm using perl, with system command from a unix web server, and need to timestamp my logs if the above format (filename _ year month day hr min sec .log) (9 Replies)
Discussion started by: CompuTelSystem
9 Replies
2. Shell Programming and Scripting
Hi, I wanna rename bunch of files which has ":" to -.
ie. rename file named file1:file1 to file1-file1.
any ideas? (2 Replies)
Discussion started by: linuxaddict7
2 Replies
3. Shell Programming and Scripting
Hi,
I'm not very experienced in shell scripting and that's probably why I came across the following problem:
I do have several hundred pairs of text files (PF00x.spl and PF00x.shd) where the first file (PF00x.spl) needs to be renamed according a string that is included in the second file... (12 Replies)
Discussion started by: inCH
12 Replies
4. Shell Programming and Scripting
Hi,
I am new to Unix and i have a requirement where i need to write a shell script where i have to loop through various files present in a directory and rename them based on below criteria.
Files in the folder are in the following format. _YYYYMMDD.dat]
SDL_V1_20100530.dat... (6 Replies)
Discussion started by: bishoo
6 Replies
5. Linux
Hi,
I want to rename all the files (more than 100 files) in a fodler to another folder with date&time stamp.
foe eg,
file1.dat
file2.dat
file3.dat
..
to be renamed as
file1100629_16_30_15.txt (yy-mon-dd_hh_mi_ss)
file1100629_16_30_16.txt
..
so on (2 Replies)
Discussion started by: feroz
2 Replies
6. Shell Programming and Scripting
Hi!
Please see our current script:
#!/usr/bin/ksh
if (egrep "This string is found in the log" /a01/bpm.log)
then
mailx -s "Error from log" me@email.com, him@email.com </a01/bpm.log
fi
To the above existing script, we need to add the following change:
1) After finding the string,... (7 Replies)
Discussion started by: atechcorp
7 Replies
7. Shell Programming and Scripting
HI,
I have a file serverlist in that all host names are placed.
i have written a small script
#./testping
#! /bin/bash
for i in `cat serverlist`
do
ping $i >> output.txt
done
so now it creates a file output.txt till here fine..
now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies
8. Shell Programming and Scripting
Hi all,
I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to
find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies
9. Shell Programming and Scripting
Hi
I have a list a filename in a directory starting with particular pattern
for example:
abc_1234.txt
abc_7565.txt
abc_7676.txt
abc_7765.txt
i need to rename all these files by appending bck. or bck_
Expected output:
bck.abc_1234.txt
bck.abc_7565.txt
bck.abc_7676.txt... (1 Reply)
Discussion started by: Little
1 Replies
10. Shell Programming and Scripting
Hey guys,
I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output)
#!/bin/bash -l
#SBATCH -p node
#SBATCH -A <projectID>
#SBATCH -n 16
#SBATCH -t 7-00:00:00
#SBATCH --mem=128GB
#SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies
LEARN ABOUT DEBIAN
path::dispatcher::cookbook
Path::Dispatcher::Cookbook(3pm) User Contributed Perl Documentation Path::Dispatcher::Cookbook(3pm)
NAME
Path::Dispatcher::Cookbook - A cookbook for Path::Dispatcher
RECIPES
How can I change the path delimiter from a space ' ' to a slash '/'?
When importing the Path::Dispatcher::Declarative sugar, specify the "token_delimiter" option for the "default" group.
package My::Dispatcher;
use Path::Dispatcher::Declarative -base, -default => {
token_delimiter => '/',
};
Or define a subclass of Path::Dispatcher::Declarative with a "token_delimiter" method:
package Web::Dispatcher::Maker;
use base 'Path::Dispatcher::Declarative';
use constant token_delimiter => '/';
package My::Dispatcher;
use Web::Dispatcher::Maker -base;
How can I do rule chaining (like in Catalyst)?
You can use a "chain" rule approximate chaining behavior:
package MyDispatcher;
use Path::Dispatcher::Declarative -base;
under show => sub {
chain {
print "Displaying ";
};
on inventory => sub {
print "inventory:
";
...
};
on score => sub {
print "score:
";
...
};
};
package main;
MyDispatcher->run("show inventory"); # "Displaying inventory:
..."
MyDispatcher->run("show score"); # "Displaying score:
..."
How can I configure tab completion for shells?
First add a dispatcher rule for generating completions based on the path. Here we name it _gencomp, so that if the user types "app _gencomp
hel" it will print out the various completions of "hel".
on qr/^_gencomps*(.*)/ => sub {
my $prefix = shift->pos(1);
$prefix = "" if !defined($prefix);
print "$_
" for dispatcher->complete($prefix);
};
Then tell your shell about how to use _gencomp. For zsh it might look like this (replace "APP" with your binary name):
/usr/share/zsh/site-functions/_APP:
#compdef APP
typeset -a APP_completions
APP_completions=($($words[1] _gencomp $words[2,-1]))
compadd $APP_completions
For bash it might look like this:
/etc/bash_completion.d/APP.bash:
function _APP_()
{
COMPREPLY=($($1 _gencomp ${COMP_WORDS[COMP_CWORD]}))
}
complete -F _APP_ APP
perl v5.12.4 2011-08-30 Path::Dispatcher::Cookbook(3pm)