View previous topic :: View next topic
|
Author |
Message |
dharmaraok
New User
Joined: 10 Mar 2011 Posts: 45 Location: india
|
|
|
|
I have a file in the PIPE delimiter format.
1|2|20150316
1|20|20150316
My output should lokk like
1|002|20150316
1|020|20150316
Second field is three byte field. if its not three bytes i have to insert zeroes infront of each value.
PLease let me know how can we achiev this by using sort command |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why do you need to do that? (can't the reader realise that the presence/absence of leading zeros does not affect the value of anything)
Why can't the source of the data make that field fixed-length for you?
If you are stuck doing it, it is a simple PARSE into three parts, and using an EDIT= for the second PARSEd field as you use BUILD to remake the line. |
|
Back to top |
|
|
dharmaraok
New User
Joined: 10 Mar 2011 Posts: 45 Location: india
|
|
|
|
This file is coming from the upstream applications thats why I want to do reformat
how can we parse it by using EDIT option |
|
Back to top |
|
|
dharmaraok
New User
Joined: 10 Mar 2011 Posts: 45 Location: india
|
|
|
|
Thanks Bill,
By using PARSE i have completeed the coding and its working fine. |
|
Back to top |
|
|
|