5
rated 0 times
[
5]
[
0]
/ answers: 1 / hits: 16869
/ 2 Years ago, thu, february 17, 2022, 2:57:15
I am using this command to copy certain line from one file to another.Its working fine.No issue with it.
sed -f <(sed -e '1,10d; 12,$d; x; s/.*/10a/;p; x' ../log/file2.txt ) ../log/file4.txt > ../log/file5.txt
The problem is instead of 10, I want to use variable VAR1 (where var1=10). The $VAR1 is not working.
I tried this command:
sed -f <(sed -e '1,$VAR1d; 12,$d; x; s/.*/10a/;p; x' ../log/file2.txt ) ../log/file4.txt > ../log/file5.txt
Please help me.
More From » command-line