문제

I have this:

bar foobar        
111 random111

I want to define $2 so that when compared to $1, it should contain only the differences (non-matching characters):

bar foo
111 random
도움이 되었습니까?

해결책

To print the differences as jaypal points out:

awk '{gsub($1,"",$2)}1' file
bar foo
111 random
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top