10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I am trying to rename files with spaces and other characters and not able to be successful.
FileNames:
UPLOAD REFERENCE.xls
UPLOAD MASS REFERENCE.XLS
find /UPLOAD REFERENCE/ -depth -type f -name "* *" -exec rename " " "_" "{}" ";"
The above one is successful to replace spaces... (1 Reply)
Discussion started by: eskay
1 Replies
2. Shell Programming and Scripting
Hi,
Friends, i have a requirement where i need to rename my files residing in multiple sub directories and move them to one different directory along with some kind of directory indicator.
For eg:
test--is my parent directory and it has many files such as
a1.txt
a2.txt
a3.txt
... (5 Replies)
Discussion started by: gnnsprapa
5 Replies
3. 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
4. Shell Programming and Scripting
Hi all,
I have more than 12000 files in 46 different directories and each directory has 2 sub-directories named “dat” or “gridded”. Dat sub-directories have files with extension “jpg.dat” and gridded sub-directories have files with extension “.jpg”.
I need to... (1 Reply)
Discussion started by: AshwaniSharma09
1 Replies
5. Shell Programming and Scripting
I can rename a file with sequential numbers from 1 to N with this script:
num=1
for file in *.dat;do
mv "$file" "$(printf "%u" $num).txt"
let num=num+1
done
The script begins with renaming a some.dat file to 1.dat.txt and goes on sequentially renaming other DAT files to... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have a directory that has a file which contained special characters in the filename. Can someone please advise how to remove the file, preferably with a rm -i ?
Thanks in advance.
Listing is as below:
{oracle}> ls -1b
bplog.bkup.001
bplog.bkup.002
bplog.bkup.003
bplog.bkup.004... (1 Reply)
Discussion started by: newbie_01
1 Replies
7. UNIX for Dummies Questions & Answers
Well, I've searched the forum, but couldn't find an option, that would help me. I'm really a dummie in unix, so here it goes.
I've got like 50k files in a single catalogue. One of them contains a string:
Including the box/square brackets. I tried to find it manually, and use some search... (2 Replies)
Discussion started by: kalik
2 Replies
8. UNIX for Dummies Questions & Answers
hello all
i have a big problems for me
if i have more files as example
test.ghrt.part01.rar
test.ghrt.part02.rar
test.ghrt.part03.rar
test.ghrt.part04.rar
test.ghrt.part05.rar
test.ghrt.part06.rar
test.ghrt.part07.rar
test.ghrt.part08.rar
test.ghrt.part09.rar
test.ghrt.part10.rar... (13 Replies)
Discussion started by: ateya
13 Replies
9. Shell Programming and Scripting
Hi,
This is what I would like to do.
1. Find all directories named "ByHost" in a specified directory
2. Rename all .plist files inside "ByHost" directories
This is the way I have been able to do it so far.
#!/bin/sh
#
# Rename ByHost files
#
# Thomas Berglund, 13.07.08
# Get the... (2 Replies)
Discussion started by: Thomas Berglund
2 Replies
10. Shell Programming and Scripting
i have hundreds of directories that have to be renamed. the directory structure is fairly uniform which makes the scripting a little simpler.
suppose i have many directories like this */*/*/*abc* (in other words i have similar directory names 3 dirs deep that all contain the pattern abc in... (8 Replies)
Discussion started by: quantumechanix
8 Replies
escape(1) Mail Avenger 0.8.3 escape(1)
NAME
escape - escape shell special characters in a string
SYNOPSIS
escape string
DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result.
EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string:
$ var='; echo gotcha!'
$ eval echo hi $var
hi
gotcha!
$
Using escape, one can avoid executing the contents of $var:
$ eval echo hi `escape "$var"`
hi ; echo gotcha!
$
A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For
example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient:
#!/bin/sh
formail -x to -x cc -x resent-to -x resent-cc
| fgrep "$1" > /dev/null
&& exit 0
echo "<$1>.. address does not accept blind carbon copies"
exit 100
To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt
script:
bodytest reject_bcc `escape "$RECIPIENT"`
SEE ALSO
avenger(1),
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 escape(1)