Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I am running Tivoli Storage Manager command "query event" and trying to basically un-wrap hostnames that are too long.
For a hostname that is longer than a certain amount of characters, a "-" is placed at the end and the last few characters are wrapped to the next line. I want to replace the "-" with the last characters of the hostname which are on the next line. See below2005/06/06 SERVER- Failed
NAME12005/06/06 SERVER1 Completed
2005/06/06 SERVER- Missed
NAME2The actual hostnames in the example above would be SERVERNAME1, SERVER1, and SERVERNAME2.
If there is a dash, I want to replace it with the first word on the next line, which would be the last characters of the jobname.
I am getting this report with awk, but can't find a way to replace the dash with first word on next line. Nothing needs to be done if no dash is found.
Any suggestions on this one?
Thanks

awk '{
dash=index($0,"-")
if (dash==0)
else
{getline overflow
print substr($0,1,dash-1) \
overflow substr($0,dash+1)}
}' filein

![]() |
Installing FreeBSD on sla...
|
sed problem
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |