Sponsored Content
Top Forums Shell Programming and Scripting To Add input to lastline of the script Post 302400937 by zeebala1981 on Thursday 4th of March 2010 02:27:35 PM
Old 03-04-2010
Question To Add input to lastline of the script

I have written some script that gives a html table output .But i cant add a line to the last line.The line should be like
----------------------------------------------------------
Generated at `system date and time`

Below is the script for your refernce.i want ti display the last line in italic

Code:
awk -v border=1 -v width=10 -v bgcolor=black -v fgcolor=white '
BEGIN { printf("<table border=\"%d\" bordercolor=\"%s\" width=\"%d\" bgcolor=\"%s\"\n>",border,bgcolor,width,fgcolor)
        printf("<th>Hostname</th><th>Volstat</th><th>Pairstat</th>\n")
}
{
print "<tr>";
        for( i = 1 ; i <= NF ; ++i )
                print "<td> "$i" </td>"
        print "</tr>"
}
END {  print "</table>" }'  /tmp/offshore/out/11.csv

Below are the ouput of script



Code:
><th>Hostname</th><th>Volstat</th><th>Pairstat</th>
<tr>
<td> chilgtp03 </td>
<td> SVOLstatus </td>
<td> SSUS </td>
</tr>
<tr>
<td> chilgtp02 </td>
<td> SVOLstatus </td>
<td> SSUS </td>
</tr>
<tr>
<td> sdclgtp04 </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> SigmaIota </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> up81056 </td>
<td> SVOLstatus </td>
<td> PSUE </td>
</tr>
<tr>
<td> up81043 </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> up2003 </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> up1061ab </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> up1218 </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> up1126 </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
<tr>
<td> uchipf053dmp </td>
<td> SVOLstatus </td>
<td> PSUE </td>
</tr>
<tr>
<td> up1242ab </td>
<td> PVOLstatus </td>
<td> PSUE </td>
</tr>
<tr>
<td> up1554 </td>
<td> PVOLstatus </td>
<td> PSUS </td>
</tr>
</table>


Thanks for reading this thread

Last edited by pludi; 03-04-2010 at 03:52 PM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

add new lines of text before and after each input line

I have a file that contains hundreds of lines such as: this_is_macro,000001 this_is_macro,000002 this_is_macro,000003 I would like to add the variable words MACROBEGIN MACRO_000001 MACROBEGIN MACRO_000002 MACROBEGIN MACRO_000003 above each line and add the word MACROEND ... (2 Replies)
Discussion started by: kenneth.mcbride
2 Replies

2. UNIX for Dummies Questions & Answers

input a float data and add them in shell in linux

I want to input a float data and add them in shell in linux. I am new user of it can anyone tell me how I can do it? thanx (5 Replies)
Discussion started by: purva
5 Replies

3. Shell Programming and Scripting

Need script to take input from file, match on it in file 2 and input data

All, I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then Insert file1 column2 to file2 column4 then create a new file. File1: 12345 Sam 12346 Bob 12347 Bill File2:... (1 Reply)
Discussion started by: darkoth
1 Replies

4. Shell Programming and Scripting

shell script to add input at certain location into a file

Hi, I am using Solaris 10 OS and trying to create shell script that can add input at certain location into a file. The input that I am trying to put is new domain name e.g @newdomain.com the file contains, more test01.out user/zzzz786@st.com/INBOX user/zzzz@po.com/INBOX... (8 Replies)
Discussion started by: Mr_47
8 Replies

5. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

6. UNIX for Dummies Questions & Answers

Find and add a field for an input file

Hello Sir/Madam, I'm new to UNIX and wondering if I can process a find & add using AWK command in UNIX? requirements: I have to find *.JPG field for each line in the input file and add it as a separate field for each line.. for ex: 0000684631,E,3088017,7... (10 Replies)
Discussion started by: V1l1h1
10 Replies

7. Shell Programming and Scripting

How to input parameters and add Columns?

Hello and good day I am not familiar with programming. I have text files and I would like to: 1) edit script to input "a" and "b" parameters by users 2)put input directories in loop : Something like this: Ex: For i in /usr/desktop/input/SG* 3)add 2 more columns and performing... (2 Replies)
Discussion started by: ali.seifaddini
2 Replies

8. Shell Programming and Scripting

Add input to text file

In the attached bash file I am trying to add a block of code to add2text that will copy the input from match to a text file (file.txt). For example, if from the menu choice 1 is select the user is asked for the id.... lets say that is 12345, after that id is matched and converted can it be added... (22 Replies)
Discussion started by: cmccabe
22 Replies

9. Shell Programming and Scripting

Search last column of INPUT.txt in TABLEs text and add correspond columns to INPUT.txt

Hi dears i use bash shell i have INPUT.txt like this number of columns different in one some row have 12 , some 11 columns see last column INPUT.txt CodeGender Age Grade Dialect Session Sentence Start End Length Phonemic Phonetic 63 M 27 BS/BA TEHRANI 3 4 298320 310050... (2 Replies)
Discussion started by: alii
2 Replies

10. UNIX for Beginners Questions & Answers

awk to add +1 to value based on condition in input

In the awk below I am trying to add a | that will adjust $2 in the ouput by adding +1 if the original value from file that was used in $3 had a - in it. Line 3 of file is an example of this. In my current awk I just subtract one but I am not sure how to only apply this to those values without a -.... (5 Replies)
Discussion started by: cmccabe
5 Replies
Bio::Graphics::Glyph::ellipse(3pm)			User Contributed Perl Documentation			Bio::Graphics::Glyph::ellipse(3pm)

NAME
Bio::Graphics::Glyph::ellipse - The "ellipse" glyph SYNOPSIS
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>. DESCRIPTION
This glyph draws an oval instead of a box; otherwise it is similar to the "generic" or "box" glyphs. The width of the oval is determined by the feature width, and the height by the -height option. OPTIONS The following options are standard among all Glyphs. See Bio::Graphics::Glyph for a full explanation. Option Description Default ------ ----------- ------- -fgcolor Foreground color black -outlinecolor Synonym for -fgcolor -bgcolor Background color turquoise -fillcolor Synonym for -bgcolor -linewidth Line width 1 -height Height of glyph 10 -font Glyph font gdSmallFont -connector Connector type 0 (false) -connector_color Connector color black -label Whether to draw a label 0 (false) -description Whether to draw a description 0 (false) -hilite Highlight color undef (no color) BUGS
Please report them. SEE ALSO
Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::triangle, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD AUTHOR
Lincoln Stein <lstein@cshl.org> Copyright (c) 2001 Cold Spring Harbor Laboratory This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2012-02-20 Bio::Graphics::Glyph::ellipse(3pm)
All times are GMT -4. The time now is 02:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy