07-30-2012
You say that the file naming convention is
but the example looks a lot more like the convention is
Quote:
filename.YYYYDDMMSSSS.txt
or
filename.YYYYMMDDSSSS.txt
I can't tell which it is from the data you supplied.
It is good that the convention uses YYYY instead of YY so it can handle century roll over issues like the Y2K problems some of us lived through.
If the convention is YYYYMMDDSSSS the script Vryali gave works fine (assuming that test.sh is a file containing a list of the files you're examining). If the convention is YYYYDDMMSSSS, you have more work to do to rearrange the month and day into an order that will sort correctly.
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I operate and use HF radars along the California coast for ocean surface currents. The devices use Mac OS as the control and logging software. The software generates thousands of files a week and while I've used PERL in the past to solve the problems of finding files I come to realize some... (6 Replies)
Discussion started by: dpath2o
6 Replies
2. Shell Programming and Scripting
as we can find file greater than 1 MB with find command as:
find /dir -name '*' -size +1M
find /dir/* -name '*' -size +1M
but wats its doing is , its finding files only in current directory not in sub-directories. i want files from sub-directories too.
Please help... Thanx in... (3 Replies)
Discussion started by: manoj_dahiya22
3 Replies
3. Shell Programming and Scripting
Hi Guys and Gals,
I'm having some difficulty putting this check into a shell script. I would like to search a particular directory for a number of files. The logic I have is pretty simple:
Find file named *.txt that are newer than <this file> and count them
If the number of files is equal to... (4 Replies)
Discussion started by: bbbngowc
4 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
I know the separate commands for finding files greater than 30 days and finding files greater than 1GB.
How do I combine these two commands?
Meaning how do I find files which are > 1GB and older than 30 days?
;) (4 Replies)
Discussion started by: Hangman2
4 Replies
5. UNIX for Dummies Questions & Answers
A newbie question...
I need to get a list of the Files and folders which are greater then a specific date. I want write the output to a Text file.
What I know ls -lrt gives me list of all the files ordered by date. Also ls > fileName will write the results to a text file.
Please help (6 Replies)
Discussion started by: rkaif
6 Replies
6. Shell Programming and Scripting
I'm having problems with my bash script. I would like to find a file matching today's date in the filename, i.e. my_file_20120902.txt and then move it to a different directory, i.e. /tmp. Thanks. (1 Reply)
Discussion started by: jamesi
1 Replies
7. Shell Programming and Scripting
Hi,
We've a list of files that gets created on a weekly basis and it has got a date and time embedded to it. Below are the examples. I want to find out how to get the latest files get the date and time stamp out of it.
Files are
PQR123.PLL.M989898.201308012254.gpg... (1 Reply)
Discussion started by: rudoraj
1 Replies
8. Shell Programming and Scripting
I have have 6 empty directory below. I would like write bash scipt if any files less "1000000000" bytes then move to "/export/home/mytmp/final" folder first and any files greater than "1000000000" bytes then move to final1, final2, final3, final4, final4, final5 and that depend see how many files,... (6 Replies)
Discussion started by: dotran
6 Replies
9. Shell Programming and Scripting
Hi,
I have a directory that has numerous files in it, and there is two which are named "filerec_ddmmyyHH24MMSS" by the time they are created so "filerec_010615012250" was created at 01:22:50 on 1st June 2015.
I need to find the most recently created of those 2 files and get the contents of... (4 Replies)
Discussion started by: finn
4 Replies
10. Shell Programming and Scripting
Hi,
I have a requirement to create a shell script(tcsh) that finds all the files in a directory having the file name containing date format "YYYYMMDDHHMM" and extract the date time part ""YYYYMMDDHHMM" for further processing.
Could you please have any idea on this.
trades_201604040000.out... (6 Replies)
Discussion started by: gopal.biswal
6 Replies
LEARN ABOUT REDHAT
unix2dos
unix2dos(1) General Commands Manual unix2dos(1)
NAME
unix2dos - UNIX to DOS text file format converter
SYNOPSYS
unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...]
Options:
[-hkqV] [--help] [--keepdate] [--quiet] [--version]
DESCRIPTION
This manual page documents unix2dos, the program that converts text files in UNIX format to DOS format.
OPTIONS
The following options are available:
-h --help
Print online help.
-k --keepdate
Keep the date stamp of output file same as input file.
-q --quiet
Quiet mode. Suppress all warning and messages.
-V --version
Prints version information.
-c --convmode convmode
Sets conversion mode. Simulates unix2dos under SunOS.
-o --oldfile file ...
Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used.
-n --newfile infile outfile ...
New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be
used or you WILL lost your files.
EXAMPLES
Get input from stdin and write output to stdout.
unix2dos
Convert and replace a.txt. Convert and replace b.txt.
unix2dos a.txt b.txt
unix2dos -o a.txt b.txt
Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode.
unix2dos a.txt -c iso b.txt
unix2dos -c ascii a.txt -c iso b.txt
Convert and replace a.txt while keeping original date stamp.
unix2dos -k a.txt
unix2dos -k -o a.txt
Convert a.txt and write to e.txt.
unix2dos -n a.txt e.txt
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt.
unix2dos -k -n a.txt e.txt
Convert and replace a.txt. Convert b.txt and write to e.txt.
unix2dos a.txt -n b.txt e.txt
unix2dos -o a.txt -n b.txt e.txt
Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt.
unix2dos -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me.
AUTHOR
Benjamin Lin - ( blin@socs.uts.edu.au )
MISCELLANY
Tested environment:
Linux 1.2.0 with GNU C 2.5.8
SunOS 4.1.3 with GNU C 2.6.3
MS-DOS 6.20 with Borland C++ 4.02
Suggestions and bug reports are welcome.
SEE ALSO
dos2unix(1)
1995.03.31 unix2dos v2.2 unix2dos(1)