Dear LoneRanger,
I have a few to questions pose in response first:-
Is this homework/assignment? There are specific forums for these.
What have you tried so far?
What output/errors do you get?
Are the ** shown actually part of the file name or just to highlight the important part?
How are you generating the listing? We might be able to process it in-line rather than writing and processing a file.
What OS and version are you using?
What are your preferred tools? (C, shell, perl, awk, etc.)
What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?
There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.
We're all here to learn and getting the relevant information will help us all.
Is this homework/assignment? There are specific forums for these.
What have you tried so far? No It's not.
What output/errors do you get? I am not getting expected output.
Are the ** shown actually part of the file name or just to highlight the important part? Just to highlight the important part
How are you generating the listing? We might be able to process it in-line rather than writing and processing a file.
I am generating it using
What OS and version are you using? I am not sure. Some flavor some Linux.
What are your preferred tools? (C, shell, perl, awk, etc.) Shell
What logical process have you considered? (to help steer us to follow what you are trying to achieve) I am trying to pick the filename , date part ,size and the order_number part and insert all into a DB table from shell script. do the comparison there an pick the right file name and pass it back into shell script for further processing.
My code so far :: it's not giving me expected output though-
For
..... do you mean
That could give the listing you have.
For the listing, am I okay to assume that it's better to show it as this:-
.... where the red highlights the selection bit and the bold are those to be picked up? Note that find does not give you a listing that is sorted in any way in particular. It just reads the directories and gives them to you in the order written, which may or may not be what you need.
Okay, now what about the rest of the questions?
Is this homework/assignment? There are specific forums for these.
What output/errors do you get?
What OS and version are you using? Run uname -a and paste the result in here in CODE tags.
What are your preferred tools? (C, shell, perl, awk, etc.)
As for "What logical process have you considered?" , well !
Okay let's make this simpler. From what you wrote, I think you want to take (maybe read in, maybe loop for all) the order number which in your examples is po........ and get the most recent file that is not empty.
Am I correct?
If so, perhaps something more like this might help:-
Let me know what you think and the answers to the other requests, if you could be so kind. There may be limitations based on what you have so that may set our choices.
Hi ,
Can anyone help me how do perform below requirement in unix.
Step1:we will receive multiple files weekly with same name(as below) in a folder(In folder we will have other files also def.dat,ghf.dat)
Filenames:
1) abc_20171204_052389.dat
2)abc_20171204_052428.dat
DON'T modify... (23 Replies)
Hi Friends,
Newbie to shell scripting
Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (12 Replies)
Hi Friends,
Newbie to shell scripting. Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (1 Reply)
I wan to pick the latest modified file name and redirect it to a file ..
ls -tr | tail -1 >file
but this is printing file ins side the filename ,
can anyone help me out (5 Replies)
I have a few log files which get generated on a daily basis..So, I need to pick only the ones which get generated for that particular day.
-rw-r--r-- 1 staff 510732676 Apr 7 22:01 test.log040711
-rwxrwxrwx 1 staff 2147482545 Apr 7 21:30 test.log.2
-rwxrwxrwx 1 staff 2147482581 Apr 7 19:26... (43 Replies)
Hi
In my script i am trying to access mainframe server using FTP,
in the server i have filee with the timestamp.I need to get the file with the latest timestamp among them . The server has the below files
/
ftp> cd /outbox
250 CWD command successful
ftp> ls
200 PORT command successful... (4 Replies)
Hi,
I am new to unix and shell scripting,can anybody help me in sctipting a requirement.
my requirement is to get the latest directory the name of the directory will be like CSB.monthdate_time stamp
like CSB.Sep29_11:16 and CSB.Oct01_16:21.
i need to pick the latest directory.
in the... (15 Replies)
in the below .. i want to pick the latest logfile which is having JPS.PR inside..
that means i want particularly "spgport040408041223.log:@@@@@@@@ 04:13:09 Adding: JPS.PR."
which is latest among these..
is it possible to compare the current time with logfile time ?
reptm@xblr0758rop>... (4 Replies)
I have task in which I need to pickup a set of files from a directory
depending on the following criteria:
Every month 6 files are expected to arrive at /test.
The files come with date timestamp and the latest file set for the month needs to be used
Suppose this is the set of files that present... (5 Replies)
Hi,
I need to get the latest file from a list of files in a particular directory.
Please could anyone help me out to get the file.
Thank you,
- Jay. (1 Reply)