Great question — answering as the UphillTech team:
var1=`grep -n "Customer_Name" report.csv | cut -d : -f1` var2='d' sed "1,${var1}${var2}" report.csv >> report_test.csv OR var1=$(grep -n "Customer_Name" report.csv | cut -d : -f1) var2='d' sed "1,${var1}${var2}" report.csv >> report_test.csv Explanation What we needed here is command substitution The command substitution can be done in two ways one is using $(…) `…` The purpose of command substitution is to evaluate the command which is placed inside the backtick and provide its result as an argument to the actual command. Difference between the two command substitution methods The old-style backquotes ` ` treat backslashes and nesting a bit different. The new-style $() interprets...
Full answer by Arushix: https://unix.stackexchange.com/a/526556 (CC BY-SA 4.0).
Need it done for your business? UphillTech.