linux - Want to append records in two file using shell script -


my first input file contains records name abc.txt:

abc@gmail.com  bscd@yahoo.co.in  abcd.21@gmail.com  1234@hotmail.com 

my second file contains record name details.txt:

123456^atulsample^1203320 

i want final file having output final.txt:

abc@gmail.com^123456^atulsample^1203320  bscd@yahoo.co.in^123456^atulsample^1203320  abcd.21@gmail.com^123456^atulsample^1203320 

i have uses sed command not getting required output.

kindly don't have knowledge in shell scripting.

try this;

#!/bin/bash while read -r line     detail="$line"     sed '/^[ \t]*$/d' abc.txt | sed "s/$/^${detail}/" >> final.txt done < "details.txt" 

this delete blank lines;

 sed '/^[ \t]*$/d' abc.txt 

this append details.txt

sed "s/$/^${detail}/" 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -