I want to replace some text of another file if match is found and position wise.
First file:
abc ram
bdc jay
vlm rock
Second file:
grep -f -w '' /d/demo.txt
grep -f -w '' /d/demo.txt
grep -f -w '' /d/demo.txt
As you can see the first file count is 3 and second file count is 3. My output should be like:
grep -f -w 'abc ram' /d/demo.txt
grep -f -w 'bdc jay' /d/demo.txt
grep -f -w 'vlm rock' /d/demo.txt
Position of first file value should be put in second file first position and so on.
abc ram
grep -f -w 'abc ram' /d/demo.txt
I have written some code but not able to build logic .. up to match two file count is done inside logic not able to do.
if [ $count_firstfile == $count_secondfile ]
then
// Logic needed here
elif [ $count_firstfile != $count_secondfile ]
then
else
echo "Nothing to do"
fi