![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Paste a word in the third field position of a file | girish.raos | UNIX for Dummies Questions & Answers | 1 | 08-17-2009 06:49 AM |
| To trim Certain field in a line of a file and replace the new string in that position | rpadhi | Shell Programming and Scripting | 4 | 08-15-2009 11:03 AM |
| filtering records based on numeric field value in 8th position | indusri | Shell Programming and Scripting | 2 | 07-10-2009 03:58 AM |
| how to find a position and print some string in the next and same position | naveenkcl | Shell Programming and Scripting | 1 | 08-21-2008 01:18 PM |
| fill a NIL into the blank field | happyv | Shell Programming and Scripting | 8 | 03-23-2007 04:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi everyone, I am using shell scripting on a Unix SCO box. It calls a C program named zerofill. I do not know anything about C. I am having an issue with a hash total that should only be zero filled 10 positions but the record has 11 positions.
DEBUG RESULTS Code:
+ nice -n -5 bc -l /tmp/fhash8395 FileHash=12010862188 + nice -n -5 /u/APS/bin/zerofill 10 12010862188 FileHash=12010862188 + nice -n -5 /u/APS/bin/zerofill 08 0000004 BatchCount=00000004 + echo 90000040001340000000412010862188000030858737000000000000 – the 9 record has 11 positions instead of 10 This hash total should be 2010862188 dropping the leading 1. Code:
#include <stdio.h>
#include <stdlib.h>
main(int argc, char *argv[]) {
int size;
if (argc != 3) usage(argv[0]);
size = atoi(argv[1]);
printf("%0*s",size,argv[2]);
}
usage(char *s) {
fprintf(stderr,"usage: %s size string\n",s);
exit(1);
}
Last edited by pludi; 4 Weeks Ago at 04:43 PM.. Reason: code tags, please... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|