Hi all,
I have the following problem which I'm sure is something to do with quoting issues?
I want to get the number of lines from a file > num_lines
and use this in a sed command to extract the contents to a new file e.g:
=======================================
num_lines=`cat ${PINLOG} | wc -l`
echo "number lines = " ${num_lines}
sed -n "1,${num_lines}p" cm.pinlog > file_temp
=======================================
This gives me the following output:
number lines = 2171
sed: command garbled: 1, 2171p
Any ideas and useful info on where I'm going wrong would be great. I have a real problem with when to use " or '
Thanks
Lee
I have the following problem which I'm sure is something to do with quoting issues?
I want to get the number of lines from a file > num_lines
and use this in a sed command to extract the contents to a new file e.g:
=======================================
num_lines=`cat ${PINLOG} | wc -l`
echo "number lines = " ${num_lines}
sed -n "1,${num_lines}p" cm.pinlog > file_temp
=======================================
This gives me the following output:
number lines = 2171
sed: command garbled: 1, 2171p
Any ideas and useful info on where I'm going wrong would be great. I have a real problem with when to use " or '
Thanks
Lee