Thanks guys, it works out fine. But now there is a greater problem since I have to move files with specical characters. So the listfile I made using the grep command:
Then I move the file using the command
The illegalCharFile file is the file contains all special characters ( like * , ' , ; ), it does not work and show variable syntax.
I did figure out if I use mv 'filename' new_directory command it would work and I try to add ' at the beginning and the end of each line in the listfile but I have not sucessed.
I would really appreciate if anyone can show me the way. thanks ^^
First: you should NOT use
or any similar construct at all. It is a "useless use of cat", but that is only the beginning: if a filename would contain a blank (or any other character special to the shell) it would not do what is expected but something entirely different.
You seem to have already found out that partially because you try to eliminate special characters somehow. Still, the way you attempt to do this will not work at all, which brings us to:
Second: what is
supposed to do? What it actually does is to replace the beginning of a line (which is no character at all, just a position a character might hold) with nothing. If this is intended to delete the complete line you'd have to write:
but in this case you can skip the beginning-of-line anchor, because ".*" will match all characters automatically - "sed"-regexps always match greedily (longest possible).
Third: the recommended (and most reliably working) way to stop the shell treating special characters specially is to quote same characters. This means i. e.:
would move all files with a name ending in "source" to directory "/target", BUT:
would move one file - the one named literally "*source" - there. This is the difference between using quotes and not using them. Now, have a look at the script i wrote above and you will find that i used exactly this mechanism to prevent any problems.
Good morning, i need your help please
I need to move a .TXT file greater or igual 355 MB and its correspondent .LST file in a non recursive way
The operating system is:
uname -a
SunOS server01c 5.10 Generic_144488-01 sun4u sparc SUNW,SPARC-Enterprise
For example:
rw-r--r-- 1 xptol ... (8 Replies)
Hi All,
I just want to move the file from one path to another using .sh file in EBS oracle apps.
I have written in .prog but i need in .sh (file.sh)
XXC_SAMPLE_FILE.prog
#!/bin/bash
# XXC_SAMPLE_FILE.prog
DATE_TIME=`date | awk {' print $1"_"$2"_"$3"_"$4 '}`
echo "parse_parms"
... (4 Replies)
Dears,
I have a listfile contains list of files path.
i need to read the line of the listfile
mv the file to other directory
and update the listfile by deleting the lines of the listfile.
#!/bin/bash
target=/fstest/INVESTIG/Sadiq/TEST_ARCH
while read -r line || ];
do
mv $line... (19 Replies)
Hi,
Anybody help me to write a Shell Script
Get the latest file from the file list based on created and then move to the target directory.
Tried with the following script: got error.
A=$(ls -1dt $(find "cveit/local_ftp/reflash-parts" -type f -daystart -mtime -$dateoffset) | head... (2 Replies)
Hi
my requirement is that i want pull the bad records from input file and move those records in to a seperate file.
that file has to be sent via email..
any suggentions please (1 Reply)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Ok in my bash script i have 5 options to create a simple html script. I need to create a temporary file and whatever the user types will be stored in that file using html codes. And then I have another option in which that temporary file will be moved to the public_html directory in which the user... (19 Replies)
Hello all.
I am new to this forum (and somewhat new to UNIX / LINUX - I started using ubuntu 1 year ago).:b:
I have the following problem that I have not been able to figure out how to take care of and I was wondering if anyone could help me out.:confused:
I have all of my music stored in... (7 Replies)
Hi,
I need to get multiple files from an ftp server. Once the files have been downloaded, I need to move them to a different directory on the ftp server. I don't know of a command that would enable me to get a file and then move it (assuming I don't know the exact file name) within ftp. I think... (10 Replies)
I need some help with a unix script to mv image files to subdirectories based on the 1st character of the filename. See example below...
/images/main
1191.jpg
9999.jpg
A101.jpg
A102.jpg
B201.jpg
c333.jpg
...
Z999.jpg
I would like to move to the following:
... (11 Replies)