HI ! all
till date I usually rename file like this
but in this case I have to rename file depending on basename of file, when I list files results like this, if there is leap year then also it should rename properly
expecting output like this
and after renaming I want to sort files in ascending order.
So you want to rename them from filenames which sort, into filenames which don't sort... Then sort them? I suspect there's a reason they're named the way they are.
Would a compromise be possible, like YYYYMMDD-September-1998? That would still sort...
I really, really like riddles or puzzles or however you may call those correctly. But this one - brilliant. 01. Sep 1997 is day of year 244, 30. Sep 1997 is 273, so the first file is for 01.Sep - 30.Sep 1997, second for 01.Oct - 31.Oct 1997, and so forth. Having found an algorithm to calculate Month-Year from the first seven digits, you're done - what problems do you expect from leap years?
And, yes, WHAT ascending order do you mean?
@ RudyC
here after renaming all files I want to sort like this
if leap year then 32-60 days,,,if not 32-59, for Feb..then march starts from 61 or 60 depending on whether leap or not,may be some function required so I just worried...
You couldn't miss aiming at the center of a broad target like a +- 30 day month, even if one month's length is off by a day in leap years. The center is the 15th of each month, or the average of month start and month end, taken to calculate the index into the months' names array:
You could even strip that down to the bare minimum:
I've taken the input stream to be sorted; if that's not the case, run it through a simple sort step first.
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)
Hi,
I have a file with few values in it. I need script help to read file line by line and check:
1/if it's a file (with extension eg .java .css .jar etc )
or
2/if it's a file without extension and treat it as a directory and then check if the directory exists in working copy else create one... (6 Replies)
Hi friend,
i have written script as below to check the file existance. but i got error
path="/k/p1100/users/jewel/Output"
FILENAME=`ls -lrt $path/*HT|tail -1|cut -d "/" -f 8`
if ; then
echo "$FILENAME is available "
chmod 755 $path/$FILENAME
/usr/bin/scp... (0 Replies)
Hello guys,
I was looking for a shell script that removes all the special characters from the files and the subdirectories recursively. I could not locate it any more. Dose any body have a similar script that dose that?
Thanks for the help.
AV (0 Replies)
Hi
I am doing some operation in which files will be dumped in Specific location.
I want to know the File type.i.e i am expecting CSV files.
So i want to write a script so that i can check the file which are dumped are in CSV Files.xxxx.csv format. (2 Replies)
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)
Dear colleagues,
One of my friend have a problem with c code. While compiling a c program it displays a message like
"array type has incomplete element type". Any body can provide a solution for it.
Jaganadh.G (1 Reply)
Hi Everyone!
I am working on a c program which displays all the directories and files under each directory.
I want to know what kind of file each is. Like, is the file an ascii text file or english text or a c file.
if it is an executable, is it an binary file or a shell script.
I was told to... (12 Replies)