I\'m trying to print every nth line from file, but n is not a constant but a variable.
n
For instance, I want to replace sed -n \'1~5p\'
sed -n \'1~5p\'
The point is, you should use double quote " instead of the single one to wrap your sed codes. Variable won't be expanded within single quote. so:
"
sed -n "1~${i} p"