ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
SessionID 2009/08/17-42
Specification ar-gecs21_FS_Daily
Started Mon Aug 17 210002
Finished Mon Aug 17 210226
Status Completed
Host nols17
SessionID 2009/08/17-44
Specification Disco_Servers_10pm_FS_Daily-2
Started Mon Aug 17 220001
Finished Tue Aug 18 045352
Status Completed
Host nols17
SessionID 2009/08/17-47
Specification Telco-DCN-FS-Daily-22_hs
Started Mon Aug 17 220016
Finished Mon Aug 17 225652
Status Completed
Host nols17
SessionID 2009/08/17-48
Specification MSSQL TPARADM04_SQL_Daily
Started Mon Aug 17 220036
Finished Mon Aug 17 235236
Status Completed
Host nols17
SessionID 2009/08/17-51
Specification Disco_D095NWSHTEC05_FS_Daily-2
Started Mon Aug 17 221502
Finished -
Status In Progress/Errors
Host nols17
In any case take in mind that the repetition is because the printf statement is executed for each input line. If you want to execute it inside the last if block you have to use brackets, since you use a multi-line block of code:
Code:
{
if ( $1 ~ /SessionID/ )
SI = $2
if ( $1 ~ /Specification/ )
SP = $2
if ( $1 ~ /Status/ ) {
ST = $2
printf ("%s\t%s\t%s\n",SI,SP,ST)
}
}
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.