hi
i have two files
file1
1234567
1234678
1234679
file2
98765|jjkskk|9393|iyutr
98765|kkooo|9393|hjjjd
98765|abcvfg|9393|sskds
output should be
1234567|jjkskk|9393|iyutr
1234678|kkooo|9393|hjjjd
1234679|abcvfg|9393|sskds
please advice
hi
i have two files
file1
1234567
1234678
1234679
file2
98765|jjkskk|9393|iyutr
98765|kkooo|9393|hjjjd
98765|abcvfg|9393|sskds
output should be
1234567|jjkskk|9393|iyutr
1234678|kkooo|9393|hjjjd
1234679|abcvfg|9393|sskds
please advice
Try the paste command, read the man pages how to change the default delimiter.
Regards
Try this....
paste -d "|" file1 file2 | cut -d "|" -f1,3-
Using just awk:
awk '{FS=OFS="|"}NR==FNR{_[NR]=$1;next}{$1=_[FNR]}1' file1 file2
Another one with awk:
awk 'BEGIN{FS=OFS="|"}{getline $1 < "file1"}1' file2
Thanks Guys it worked