The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Insert character in the line swat UNIX for Dummies Questions & Answers 1 06-30-2009 12:12 PM
Need to search and replace based on character count vijaykrc Shell Programming and Scripting 3 02-19-2009 01:48 PM
how to check and remove leading zeroes from the buffer using c program amitpansuria High Level Programming 1 11-11-2008 12:24 PM
Add leading zeroes to numbers in a file raidzero Shell Programming and Scripting 3 06-17-2008 12:06 PM
How to trim the leading zeroes in a Currency field ? Amruta Pitkar Shell Programming and Scripting 22 05-29-2007 05:45 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-30-2009
gpaulose gpaulose is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 16
insert leading zeroes based on the character count

Hi,

I need add leading zeroes to a field in a file based on the character count. The field can be of 1 character to 6 character length. I need to make the field 14bytes.

eg:
8351,20,1
8351,234,6
8351,2,0
8351,1234,2
8351,123456,1
8351,12345,2

This should become.

8351,00000000000020,1
8351,00000000000234,6
8351,00000000000002,0
8351,00000000001234,2
8351,00000000123456,1
8351,00000000012345,2

Any help will be much appreciated.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0