Try this, maybe there is an easier way, but at the moment here is what should work, hoping you are on some linux flavor, if not, then let me know what flavor of UNIX are you on, we may have to modify /bin/ksh to /usr/bin/ksh or wherever ksh is on your UNIX variant.
Put the the list of new* names in a file called /tmp/list. Put the below code in /tmp/script.sh and chmod +x /tmp/script.sh
Run the script in the directory where you have the new* files by running the script as /tmp/script.sh, when you run the script, it will echo out the moves/renames, if you like what you see, remove the echo in front of the mv, and then run it.
Hi ,
I'm trying to list the files and output is written to a file. But when I execute the command , the output file is being listed. How to exclude it ?
/tmp
file1.txt
file2.txt
ls -ltr |grep -v '-' | awk print {$9, $5} > output.txt
cat output.txt
file1.txt
file2.txt
output.txt (8 Replies)
I'm interested in writing a report script using BASH that searches all of the files in a particular directory for a keyword and printing a list of files containing this string...
In fact this reporting script would have searches for multiple keywords, so I'm interested in making multiple... (2 Replies)
Hi, I have a control file which will contain all filenames(300) files. Loop through all the file names in the control files and check the existence of this file in another directory(same server). I need to infinitely(2 hrs) run this while loop until all the files are found. Once a file is found,... (5 Replies)
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
I'm trying to find a Bourne shell script that will copy files from one directory using a wild card for the file name (*) and add some more characters in the middle of the file name as it is copied. As an example:
/u01/tmp-file1.xml => /u02/tmp-file1-20130620.xml
/u01/tmp-file2.xml => ... (6 Replies)
Hi,
I have a list of zipped files. I want to grep for a string in all files and get a list of file names that contain the string. But without unzipping them before that, more like using something like gzcat.
My OS is:
SunOS test 5.10 Generic_142900-13 sun4u sparc SUNW,SPARC-Enterprise (8 Replies)
hi,
I am copying a file from 1 folder to another in /bin/sh. if the file already exists there, it should get copied as filename1. again if copying next time it shouldget copied as filename2.. , filename3..so on..
The problem is i am able to get uptil filename1.. but how do i know what... (6 Replies)
I have two servers. I would like to copy some files from one directory on server A into the same directory on server B.
Its not all the files in in the directory, just some of them.
Is there a way to make a file list in a txt file and then somehow copy all the files in that list in one go to... (6 Replies)
Hi,
I have to copy a set of files abc* in /path/ to /path1/ as abc*_bkp.
The list of files appear as follows in /path/:
abc1
xyszd
abc2
re2345
abcx
..
.
abcxyz
I have to copy them (abc* files only) into /path1/ as:
abc1_bkp
abc2_bkp
abcx_bkp
..
. (6 Replies)
When I do the following :
grep -l "string" *,
I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?.
Thanks. (4 Replies)