Artificial intelligent assistant

append lines after another files line by line Append one file, 011C0201.WAV 011C0202.WAV 011C0203.WAV 011C0204.WAV 011C0205.WAV After another file, 52 601 39 608 56 1016 39 416 65 335 result is the following, also divide by tab 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 Here is what I do awk ' NR==FNR { start=$1; end=$2; next} { print $0 start end } ' WSJ_310P_PC_16k.epd WSJ_310P_PC_16k.spt > tmp But it is not working. What am I doing wrong?

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

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2f62908a8669b97fe166904f9795530d