Sponsored Content
Full Discussion: Count string at header.
Top Forums Shell Programming and Scripting Count string at header. Post 302115004 by Helmi on Friday 20th of April 2007 04:07:52 AM
Old 04-20-2007
on the otherhand,

why this data comu out like this:
Code:
2B5027939545082007031920060617+.00MYR19A0140002                                  
2B5027939550082007031920060617-64.59MYR190140002                           
2B5027939573102007031920060617-943.06MYR190140002                           
2A9201931083052007031920060617+.00MYR19K0140002

instant of this:
Code:
2A500222577302 2007031920060617+        .00MYR19A0140002                        
2B502793954508 2007031920060617+        .00MYR19A0140002                        
2B502793955008 2007031920060617-      64.59MYR19 0140002                        
2B502793957310 2007031920060617-     943.06MYR19 0140002                        
2A920193108305 2007031920060617+        .00MYR19K0140002

is there something wrong in this code:
Code:
 Count2 = Count2 + 1;
        split($0,a,FS);
        
        Header = a[1];
        gsub(" ", "",Header);
        AcctNo = a[2];
        gsub(" ", "",AcctNo);
        LastBillDt = a[3];
        gsub(" ", "",LastBillDt);
        DueDt = a[4];
        gsub(" ", "",DueDt);
        PymtAmt = a[5];
        gsub(" ", "",PymtAmt);
        Myr = a[6];
        BillPd = a[7];
        AcctStat = a[8];
        KodHsl = a[9];
        SorceSys = a[10];                       
        str = str sprintf("%-2s%-14s%-8s%-8s%-13s%-3s%-2s%-1s%-3s%-4s\r\n", Header, AcctNo, LastBillDt, DueDt, PymtAmt, Myr, BillPd, AcctStat,KodHsl,SorceSys) ;

it seem that this script remove the white spaces(in the bold area) which have to be remained in the original place.
Smilie sorry to ask again, i've tried but become worse than the original one.

Last edited by Helmi; 04-20-2007 at 05:16 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count No of Records in File without counting Header and Trailer Records

I have a flat file and need to count no of records in the file less the header and the trailer record. I would appreciate any and all asistance Thanks Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies

2. UNIX for Dummies Questions & Answers

Checking the header and trailer for a given string and if not found, exit out of the

hi, How to check a given file for a string and if it's not found, exit out ofthe script? e.g. a file Test123 is there whose header begins with #bt and trailer begins with #ed. I have to check if the header and trailer matches as above and if not, exit out of the script. How can we do it in... (2 Replies)
Discussion started by: er_ashu
2 Replies

3. Shell Programming and Scripting

Inserting a String in a file header.

Dear all, I have a file created in the name sample.txt in UNIX with header and footer. How to insert a required string (for example "FILE1") in the header part after the file has been created. What kind of command can i use to do the same. Thanks in advance Hari (3 Replies)
Discussion started by: Hari123
3 Replies

4. Shell Programming and Scripting

Header as is.. trailer count

i have .DAT file FILE1.DAT 1200910270040625 2123456789 J123456 ABC 2123456789 K123456 ABC 2222222222 L123456 DEF 2333333333 M12345 GHI 30000004 My outfile FILE2.TXT should have like this, I need the header value as ie (1200910270040625 ) body rows remove the duplicate rows and the... (2 Replies)
Discussion started by: kshuser
2 Replies

5. Shell Programming and Scripting

Extract columns where header matches a given string

Hi, I'm having trouble pulling out columns where the headers match a file of key ID's I'm interested in and was looking for some help. file1.txt I Name 34 56 84 350 790 1215 1919 7606 9420 file2.txt I Name 1 1 2 2 3 3 ... 34 34... 56 56... 84 84... 350 350... M 1 A A A A... (20 Replies)
Discussion started by: flotsam
20 Replies

6. Shell Programming and Scripting

Need awk help to print specific columns with as string in a header

awk experts, I have a big file of 4000 columns with header. Would like to print the columns with string value of "Commands" in header. File has "," separator. This file is on ESX host with Bash. Thanks, Arv (21 Replies)
Discussion started by: arv_cds
21 Replies

7. Programming

Error with the string.h header

I get this error when I try to compile following C program #include <stdio.h> #include <strings.h> #define LEN 80 int main(void) { int mess, flag = 1; int first = 0, last = 0; printf("Enter a message: "); gets(mess); if (strlen(mess) > LEN) ... (3 Replies)
Discussion started by: solaris_user
3 Replies

8. UNIX for Dummies Questions & Answers

File Row Line Count without Header Footer

Hi There! I am saving the file count of all files in a directory to an output file using: wc -l * > FileCount.txt I get: 114 G4SXORD 3 G4SXORH 0 G4SXORP 117 total But this count includes header and footer. I want to subtract 2 from the count and get ... (7 Replies)
Discussion started by: gagan8877
7 Replies

9. Shell Programming and Scripting

Compare file1 header count with file2 line count

What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Discussion started by: pone2332
4 Replies

10. Shell Programming and Scripting

Grep a string and count following lines starting with another string

I have a large dataset with following structure; C 0001 Carbon D SAR001 methane D SAR002 ethane D SAR003 propane D SAR004 butane D SAR005 pentane C 0002 Hydrogen C 0003 Nitrogen C 0004 Oxygen D SAR011 ozone D SAR012 super oxide C 0005 Sulphur D SAR013... (3 Replies)
Discussion started by: Syeda Sumayya
3 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 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy