Thanks - but that doesn't work - the output is "unsorted", still contains the timestamp which I don't need.
Code:
h20150204.log.001 05:10:30 completed successfully
h20150207.log.001 05:50:30 JOBFAILURE: COMPLETED WITH ERRORS RC=201
h20150210.log.001 00:57:23 JOBFAILURE: COMPLETED WITH ERRORS RC=201
h20150211.log.003 00:35:39 OTHER MESSAGE
h20150127.log.001 02:32:00 completed successfully
-----
Regards,
Ian
That is strange. By default, the output from ls is sorted by filename and (as long as the character(s) in your log file names before the date stamp is(are) constant) the output should be in sorted order. And, tail won't rearrange the output order, and the for loop won't rearrange the output order. Are there hidden characters in your filenames? Did you pass options to ls that I didn't use? Is there a filename ending with .log. followed by three digits that has a minus sign as its first character?
I didn't see your additional requirement to strip out the timestamp until after I submitted my response. You already have suggestions on how to deal with that (as long as the last lines of your log files don't contain adjacent sequences of multiple spaces and tabs that you don't mind being converted to single spaces).
This User Gave Thanks to Don Cragun For This Post:
Don't want to take too much of your time - given that I have a result - however, to answer your points:
I copied & executed your code exactly from your reply - and pasted the output. As far as I know, there are no hidden characters, no minus signs and nothing added.
Interestingly, if I execute the bracketed ls statement, I get this:
this lists them top to bottom, left to right
###
looking at the output from the whole command, it is presenting the files in left to right top to bottom from the above output - if you know what I mean - ie the top row of the output above is represented as the start of the output below....
When ls output is directed into a pipe (or, for that matter, anything that is not directed to a terminal), the standards require it to produce one filename per output line; nothing at all like what you showed in your last post!
On the machine from which the output has been taken:
Code:
> uname -srv
HP-UX B.11.23 U
I'm not making it up - the results are absolutely copied & pasted from the live server I happen to be working on at the moment - I'll try it elsewhere when I have the opportunity.
---
Regards,
Ian
---------- Post updated at 02:48 AM ---------- Previous update was at 02:42 AM ----------
I've been given a directory full of subdirectories full of logfiles of the same name:
/logfiles/day1/file1/blockednodes.csv
day1-14
file1-48
The above is the actual directory structure for 14 days worth of a logfile that is generated every 30 minutes. It's been done this way to preserve the... (15 Replies)
Running a Power 5 Blade on AIX, with remote connectivity issues via putty.
AIX V 6.1.00-02
openssh V5.2.0.5300
openssl V0.9.8.1103
Intermittent remote connections. Seems to connect every other time I try via my putty client.
Using hosts.allow and hosts.deny to filter IP Addrss... (2 Replies)
Ok then i Have a challenge for you :
Give me PS1 so that it always display the least 2 levels of directory
(except if i am above of course)
I want it this way :
so if i go to
/
/home/
/home/user
/home/user/whatever
/home/user/whatever1/whatever2
my PS1 should respectively... (12 Replies)
Hi everybody, I'm new to these forums and this is my first post. A couple days ago I was trying to find a simple script that would return an individual's local weather conditions using I.P. based geolocation. After many failed search attempts, I began my quest to create this for myself. I have to... (0 Replies)
Here's a regex substitution operation that has stumped me with sed:
How do you convert lines like this:
first.key ?{x.y.z}
second.key ?{xa.ys.zz.s}
third.key ?{xa.k}
to:
first.key ?{x_y_z}
second.key ?{xa_ys_zz_s}
third.key ?{xa_k}
So i'm basically converting all the... (11 Replies)
I have a web xml file that looks like this:
<allinfo>
<info>
<a>Name1<\a>
<b>address1<\b>
<c>phone1<c>
<\info>
<info>
<a>Name2<\a>
<b>address2<\b>
<c>phone2<c>
<\info>
<\allinfo>
I want to use sed to... (2 Replies)
Hi all,
Thanks in advanced.
This question really bothered me much. What i want is to replace any times of repeated 'TB' to 'T', below is example.
It can be fullfil by AWK and perl, but my desire is using SED to realize it.
So here means we treat TB as a whole part, which means 's/TB*/T/'... (4 Replies)
I have the following text
Microsoft iSCSI Initiator version 2.0 Build 3497
Targets List:
iqn.2001-05.com.equallogic:0-8a0906-daef43402-138000002a4477ba-grsrv12-extra
iqn.2001-05.com.equallogic:0-8a0906-986f43402-520000002b447951-exchange
... (9 Replies)
Hi, there are some servers here at work which issue a Safeword challenge after I login. Can anyone tell me exactly how the challenge/response system works? In particular, how are the valid keys decided? (2 Replies)
Okay - I've been searching near and far for the answer to this seemly simple question..... how do I find the X25 address for a server. Is there some sort of dump or ping or even a config which would tell me the address.
I can find nothing on the web and my colleagues can't help either. (1 Reply)