"Ed Morton" <morton@[EMAIL PROTECTED]
> schreef in bericht
news:47AAA91F.9010208@[EMAIL PROTECTED]
>
>
> On 2/6/2008 8:35 PM, Combatwombat wrote:
>> ##ALERT!!!### Noobie struggling with Awk
>>
> a) "getline" is almost certainly the wrong approach.
> b) concatenating both files and setting awk variables with their names
is
> also
> almost certainly the wrong approach.
> c) let's start with this:
>
> awk '{print FILENAME, $0}' old.csv replacement.csv > newfile
>
> so you can see how you can run an awk script on multiple input files and
> we'll
> take it from there.
>
> Ed.
>
awk '{ print FILENAME, FNR, NR }' old.csv replacement.csv
will output
old.csv 1 1
old.csv 2 2
old.csv 3.3
replacement.csv 1 4
replacement.csv 2 5
replacement.csv 3 6
so, you can check in your script which inputfile you're reading from bye
comparing FNR and NR
so, i would start with:
awk 'NR=FNR{ repl[$1]=substr($0,length($1+1)); next; } { rest of your
script, which checks if repl[] things are contained in file old.csv }'
replacement.csv old.csv


|