![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| combining fields in two text fields | shocker | Shell Programming and Scripting | 3 | 01-16-2008 07:27 AM |
| amount of memory in my server | new2ss | UNIX for Dummies Questions & Answers | 2 | 11-06-2006 06:28 AM |
| sed X amount of times - X is dynamic | Loriel | Shell Programming and Scripting | 2 | 02-17-2005 04:38 PM |
| Amount of RAM (Memory) | samudimu | UNIX for Dummies Questions & Answers | 4 | 07-29-2003 10:40 AM |
| How to get amount of memory installed. | elgholm | UNIX for Dummies Questions & Answers | 4 | 08-24-2001 04:04 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Trimmng leading 0's from amount fields
Hi
I need to remove leading zeros if that filed is amount filed and trimmimg leading and trailing spaces U | U|1999-01-01|000004384|000002192|0000000000000000.0000|0000000000000000.0000| U|XXX|0000000000000685.5800| FIXED |U Tried with this command ,I am not getting expected o/p sed -e 's/ *|/|/g' -e 's/[ ]*^//g' -e 's/|00*\/|0\./g' file o/p U|U|1999-01-01|000004384|000002192|0.0000|0.0000|U|XXX|685.5800|FIXED|U Thanks in advance Mohan |
| Forum Sponsor | ||
|
|
|
|||
|
Hi,
echo "U | U|1999-01-01 |000004384|000002192|0000000000000000.0000|0000000000000000.0000| U|XXX|0000000000000685.5800| FIXED |U" | sed -e 's/| */|/g' -e 's/ *|/|/g' -e 's/|00*/|/g' -e 's/|\./|0\./g' Output: U|U|1999-01-01|4384|2192|0.0000|0.0000|U|XXX|685.5800|FIXED|U Thanks Penchal |