
05-27-2009
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
|
|
Quote:
Originally Posted by mohan705
Hi
I have flat file with 100 records ,I need to fabricate data into flat file .
ex:
Code:
file.txt
102345 1000 200 300
...............................
..............................
102346 2000 300 4000
In above file the 4th row, 1 st column valu to be increment by 1
and rest of the values are same for 1000 lines.
102347 2000 300 4000
102348 2000 300 4000
|
Code:
awk 'NR == 4 { $1 = $1 + 1 } { print }' file.txt
If you want more lines than the 4th incremented, change NR == 4. For example, to get the 4th to the end of the file, change it to NR >= 4.
|