View Full Version : how can I do this with AWK
confi999
Sep16-09, 07:12 AM
Hi,
I need to modify a shell script and add the following into it:
location: 200 200 1
location: 200 200 2
location: 200 200 3
---------
---------
---------
location: 200 200 449
location: 200 200 500
I thought using some awk command one could produce the series 1,2,.... 500 in the last column of all the 500 lines. Can anyone help me with that command.
Thank you very much.
Hi,
I need to modify a shell script and add the following into it:
location: 200 200 1
location: 200 200 2
location: 200 200 3
---------
---------
---------
location: 200 200 449
location: 200 200 500
I thought using some awk command one could produce the series 1,2,.... 500 in the last column of all the 500 lines. Can anyone help me with that command.
Thank you very much.
if you just want a filter to add numbers to the end of each line...
awk '{ print $0, ++x; }'
confi999
Sep16-09, 07:55 AM
if you just want a filter to add numbers to the end of each line...
awk '{ print $0, ++x; }'
Hi,
Thanks!
I want to write a small script or an awk command (or if any other way) that will produce a file which has all those 500 lines in it.
Hi,
Thanks!
I want to write a small script or an awk command (or if any other way) that will produce a file which has all those 500 lines in it.
Here's a shell script
#!/bin/sh
for (( n=1 ; n <= 500 ; n++ )) do
echo location: 200 200 $n
done
confi999
Sep16-09, 09:41 AM
Here's a shell script
#!/bin/sh
for (( n=1 ; n <= 500 ; n++ )) do
echo location: 200 200 $n
done
Thank you sooo much.
vBulletin® v3.7.6, Copyright ©2000-2009, Jelsoft Enterprises Ltd.