The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > HP-UX
Google UNIX.COM


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help needed in padding leading zeros jakSun8 Shell Programming and Scripting 12 07-02-2008 04:41 PM
Removing leading zeros from a variable toshidas2000 Shell Programming and Scripting 6 02-27-2008 10:13 AM
Padding with zeros. sbasetty Shell Programming and Scripting 3 02-06-2007 11:02 PM
Removing empty spaces and adding commas jazz High Level Programming 4 11-13-2006 06:54 AM
removing commas from text file hcclnoodles UNIX for Dummies Questions & Answers 6 03-26-2003 01:43 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2005
Registered User
 

Join Date: Nov 2005
Posts: 1
Padding zeros after removing commas in file

Hi Gurus,

There is a ASCII file in which a comma is used as a seperator for the amount field when the amount exceed seven digits: e.g. 0001300,000. Now, this comma needs to be removed from this field, after padding leading zeros (to maintain the ASCII positions) e.g. 00001300000. Could anyone post a detailed solution which can handle this requirement?. There are multiple records in the file which fall under this category.


Thanks for your help

Prakash
Attached Files
File Type: doc commas.doc (29.0 KB, 7 views)
Reply With Quote
Forum Sponsor
  #2  
Old 11-09-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
This is gnu sed....
Code:
$ echo "0001300,000" | sed -r 's/([0-9]{7}),([0-9]{3})/0\1\2/'
00001300000
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0