Sponsored Content
Top Forums Shell Programming and Scripting Parsing of Char and Numeric in a file Post 302959588 by fedora132010 on Wednesday 4th of November 2015 07:41:11 PM
Old 11-04-2015
Parsing of Char and Numeric in a file

Hi All,

i'm working on some report and currently have this plain text file generated.

Code:
server_name1|sdfd1deal      |        1048572|        1040952|    99|      207|        1|       1
server_name1|dba1dbs        |       83886048|       40730796|    48|     5762|    22764|       8
server_name1|dbsd1phpal     |      503316320|       38609208|    07|     1087|      535|      40
server_name1|dbsd1dbsdl     |      199229388|       59869752|    30|      120|     6322|      13
server_name1|dbsd1deal      |      534773604|       50339708|    09|     8048|    21015|      39
server_name1|dbsd1eal       |      511704944|       84434568|    16|      524|      386|      36
server_name1|dbsd2dbsdl     |       94371828|       31457264|    33|       24|        4|       3
server_name1|dbsd3dbsdl     |      125829104|       27361264|    21|       27|        5|       4
server_name1|dbsd4dbsdl     |      157286380|       69732856|    44|       35|      364|       5
server_name1|dbsd5dbsdl     |       62914552|       36914328|    58|       11|        3|       2
server_name1|rootdbs1       |        2097148|        2072792|    98|     1116|    36319|       1


I want to convert it into HTML and got this code.

Code:
  {print "<tr>"
    for(i=1;i<=NF;i++)
        print "<td>" $i"</td>"
    print "</tr>"

My problem is the numeric columns shows left justified. I want all the columns to be right justified.

thanks in advance for anyone who can help.

This is currently in AIX, using ksh shell.

Fe

Last edited by Scrutinizer; 11-06-2015 at 01:06 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check a column contain numeric or char data type ??

I have a file called clientname_filename.csv whose contents are like col1|col2|col3|col4| 510|abc|xxx|450| 510|abc11|yyy|350 510|pqr99|zzz| 670 512|222|439|110 Here i have check the contents of column for data type. i have a constraints that col1 always contain Numeric value column 2... (12 Replies)
Discussion started by: jambesh
12 Replies

2. Shell Programming and Scripting

Perl code to differentiate numeric and non-numeric input

Hi All, Is there any code in Perl which can differentiate between numeric and non-numeric input? (11 Replies)
Discussion started by: Raynon
11 Replies

3. Shell Programming and Scripting

Parsing char string

I am stumped! I need to parse an input parameter to a script that has the form '-Ort'. I basically need 'O', 'r' and 't', i.e. the individual characters in the string parsed. Since there are no delimiters, I don't know how awk could do this. Can someone tell how to do this, this should be a... (5 Replies)
Discussion started by: ALTRUNVRSOFLN
5 Replies

4. Shell Programming and Scripting

Parsing X char from right to left

I am new to bash scripts I need something quite easy to do in VBS, When I wanted to get the first 5 chars I used funcition right(5,strGet) how can I do the same in bash? I am trying to get the MAC address in Ubuntu I have done so far ifconfig wlan2 | grep HWaddr | awk '{print $5}' | sed -e... (3 Replies)
Discussion started by: 4scriptmoni
3 Replies

5. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

6. Shell Programming and Scripting

PERL:How to convert numeric values txt file to PACKED DECIMAL File?

Is there any way to convert numeric values txt file to PACKED DECIMAL File using PERL. Regards, Alok (1 Reply)
Discussion started by: aloktiwary
1 Replies

7. Shell Programming and Scripting

Converting Char to Numeric

HI, Here I have the following output and want to do some mathematical calculation on C2 & C3 column. c1 c2 c3 c4 c5 l1 1-oct 12:30:01 12:35 abc xyz l2 1-oct 14:20:01 14:35 def ... (5 Replies)
Discussion started by: dear_abhi2007
5 Replies

8. UNIX for Dummies Questions & Answers

Find and Replace random numeric value with non-numeric value

Can someone tell me how to change the first column in a very large 17k line file from a random 10 digit numeric value to a non numeric value. The format of lines in the file is: 1702938475,SNU022,201004 the first 10 numbers always begin with 170 (6 Replies)
Discussion started by: Bahf1s
6 Replies

9. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

10. Shell Programming and Scripting

Need to add a numeric & special char to end of the first line

Need to add a numeric & special char to end of the first line Existing file: 12-11-16|11 2016 Jan 12:34:55|03:55| 13-10-16|10 2016 Jan 12:34:55|03:55|12-11-16|11 2016 Jan 12:34:55|03:55| 14-10-16|19 2016 Jan 12:34:55|03:55|13-11-16|11 2016 Jan 12:34:55|04:55| 15-10-16|18 2016 Jan... (11 Replies)
Discussion started by: Joselouis
11 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 02:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy