1) The data i have provided is just a dummy data because i am not allowed to provide real data.i agree with your concerns
2) I just want set of files per month/year to iterate through.
3) i want to find files with first two dates & last date for that month/year
---------- Post updated at 03:38 AM ---------- Previous update was at 03:11 AM ----------
Hi Don
I am getting below error.Any help
my unix version
Dummy data is fine. You can change the files' owners to "user" (or if there are multiple users, "user1", "user2", ...) and the files' group names to "group" (or "group1", "group2", ...) and the files' names to "x1.txt", "x2.txt", ... "xn.txt", but changing output like:
to:
hides information that is crucial to getting the results you want. You should easily be able to the save output from ls -lt in a file, edit the file to sanitize private data, and post the sanitized output without hiding data that your script is going to need to use to get the job done.
I explicitly said "the following Korn shell script (when using a 1993 or later version of ksh)". /bin/ksh on Solaris 8 is a 1988 version of the Korn shell. The 1988 version of the Korn shell doesn't have associative arrays. The awk script I provided should work fine for you if you change awk to /usr/xpg4/bin/awk or nawk. (I don't remember the path, but there might also be a 1993 version of ksh on Solaris 8 with a pathname something like /usr/dtbin/dtksh. You might be able to find it with: ls /usr/*/dtksh /usr/*/*/dtksh
With the output that script provides you can easily grep for ":Oct 2013:" (or any other month and year you want) to find the files for that month and year. I assume you can pick the 1st two and the last one out of the matching grep output to get the files you want to process for that month. Of course it would also be pretty easy to just modify the awk script or a shell script to pass in the month and year you want and have it only print the names of the three (or all, if there are less than three) files that you want for that month.
Try to build on what we've given you here to get what you want. If it doesn't work, start another thread showing us what you have done, what (sanitized) input you're processing, and what output you;re hoping to get.
This User Gave Thanks to Don Cragun For This Post:
Hi All,
lets say there are following files in directory
-rwxr-xr-x 1 user userg 1596 Mar 19 2012 a.txt
-rwxr-xr-x 1 user userg 1596 Mar 19 2012 b.txt
-rwxr-xr-x 1 user userg 1596 Mar 22 2012 c.txt
-rwxr-xr-x 1 user userg 1596 Mar 24 2012 d.txt... (16 Replies)
how to find all files other than first two dates & last date per month and year
Hi All,
lets say there are following files in directory
-rwxr-xr-x 1 user userg 1596 Mar 19 2012 a.txt
-rwxr-xr-x 1 user userg 1596 Mar 19 2012 b.txt
-rwxr-xr-x 1 user userg ... (6 Replies)
Hi All,
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12... (16 Replies)
Hi All,
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12... (2 Replies)
Hi
I have files like
abc_cd_20110302_123423
abc_cd_ef_20110301_123423
abc_cd_ef_20110403_123423
abc_ef_20110401_123423
I want to extract the
the year and month associated with each file.
I tried
logfileyearmonth=`echo $logfile | awk -F_'{print $NF}'`
Any other way can I... (6 Replies)
Hi,
I'm working on a Informix4gl module. I'm just trying to find out any built-in function to fetch only the year/month from an INTERVAL YEAR TO MONTH data value.
Please let me know, if there are any functions to do this. If not, let me know for any alternative solutions to attain this.
... (5 Replies)
Hi Im trying to concatenate a specific file from each day in a year/month/day folder structure using Bash or equivalent. The file structure ends up like this:
2009/01/01/products
2009/01/02/products
....
2009/12/31/products
The file I need is in products everyday and I need the script to... (3 Replies)
Hello all,
Might be a silly question, on my AIX machine the year had changed to 2022 and some files were accessed on this date hence the time stamp on these files is with year 2022, there are many such files. i want to list all these file from the root dir and subdir with 2022 year... (3 Replies)