append lines after another files line by line

How about paste + awk?

$ paste one another | 
    awk '{print $1, $2 "_" $3 "_" substr($1,1,length($1)-4)}' OFS='\t'
011C0201.WAV    52_601_011C0201
011C0202.WAV    39_608_011C0202
011C0203.WAV    56_1016_011C0203
011C0204.WAV    39_416_011C0204
011C0205.WAV    65_335_011C0205

If you prefer to do it entirely in awk:

awk 'NR==FNR {a[FNR]=$0; next} {print a[FNR], $1 "_" $2 "_" substr(a[FNR],1,length(a[FNR])-4)}' OFS='\t' one another

Here is one using pure awk

awk '
    NR==FNR {a[NR]=$0; next}
    {
        split(a[FNR],b,".");
        printf "%s\t%s_%s_%s\n", a[FNR], $1, $2, b[1]
    }
' file1 file2

Tags:

Shell

Awk