string operation - awk
This is a discussion on string operation - awk ; I have one file like:
1 234
2 34
4 345
3 1
How can I change the file into the following file:
1 0234
2 0034
3 0345
4 0001
Thank you...
-
string operation
I have one file like:
1 234
2 34
4 345
3 1
How can I change the file into the following file:
1 0234
2 0034
3 0345
4 0001
Thank you
-
Re: string operation
On 25 Jul., 16:51, qingpin <chunkaow...> wrote:
> I have one file like:
>
> 1 234
> 2 34
> 4 345
> 3 1
>
> How can I change the file into the following file:
>
> 1 0234
> 2 0034
> 3 0345
> 4 0001
>
> Thank you
awk '{printf ("%d %04d\n", $1, $2)}'
Janis
-
Re: string operation
qingpin <chunkaowang> writes:
> I have one file like:
>
> 1 234
> 2 34
> 4 345
> 3 1
>
> How can I change the file into the following file:
>
> 1 0234
> 2 0034
> 3 0345
> 4 0001
awk '{printf("%d %04d\n",$1,$2)}'
is *probably* what you want, if the rest of your input is similar.
Cheers,
- Joel
-
Re: string operation
On Jul 25, 5:16 pm, Joel Reicher <j...@panacea.null.org> wrote:
> qingpin <chunkaow...> writes:
> > I have one file like:
>
> > 1 234
> > 2 34
> > 4 345
> > 3 1
>
> > How can I change the file into the following file:
>
> > 1 0234
> > 2 0034
> > 3 0345
> > 4 0001
>
> awk '{printf("%d %04d\n",$1,$2)}'
>
> is *probably* what you want, if the rest of your input is similar.
>
> Cheers,
>
> - Joel
Thank you very much!
Similar Threads
-
By Application Development in forum labview
Replies: 0
Last Post: 12-08-2007, 03:10 PM
-
By Application Development in forum labview
Replies: 1
Last Post: 12-08-2007, 02:40 PM
-
By Application Development in forum c++
Replies: 2
Last Post: 08-16-2007, 02:13 PM
-
By Application Development in forum Microsoft Money
Replies: 2
Last Post: 06-26-2007, 02:19 PM
-
By Application Development in forum Java
Replies: 4
Last Post: 05-17-2004, 07:28 AM