brand new to unix (let alone scripting) I have come hit a step I can't seem to get around.
in a text file I have information such as :-
INFORM_USERS_IB COMPLETED llprod 20011003:100608
What I need to do is extract the 55th and 56t charachter, then insert a : then extract the 57th and 58th.. to give me an end result of:-
10:06
problem is how do I count of extract these charachters as they change frequently but *should* stay in the correct position??
(also does tab count as a single char?)
Or is there an easier way to reformat a date and time string?
there are approximately 20 similar lines for each title
"INFORM_USERS_IB " and the times will update.
is it possible to format each line sequentially using the second line of code, that way bypassing the need to define changing lines?
You lost me there, but the sed statement should work for any similiar line. I just posted an easy way to demo it.
The sed statement discards all characters up to and including the colon. The next two chars are saved. Then a colon is inserted. Then the next two chars are saved. Everything else is discarded.
So as long as the time is the 4 chars following the first colon on the line everthing should be fine.