![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
This is gnu sed....
Code:
$ echo "0001300,000" | sed -r 's/([0-9]{7}),([0-9]{3})/0\1\2/'
00001300000
|
||||
| Google The UNIX and Linux Forums |