Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

normalization 1

Status
Not open for further replies.

ovince

Programmer
Feb 27, 2007
55
FR
hi


I would like to normalize second column of dataFile to number at 1000 row of second column. I do this by looking what number I have in 1000th row of second column first and then

awk'{print $1, $2/23.45}' file

Must be an easier way to do this I am sure. some suggestions?

thanks
 
there is no problem but I wanted to automatise the process since I have many files
 
Oh, I see, I didn't realise you were doing that part manually.

Try this:

Code:
awk '
        NR == FNR && NR == 1000 { d=$2; nextfile }
        NR != FNR { print $1,$2/d }
' inputfile inputfile

Notice that inputfile is specified twice.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top