Hi,
I'm new here so I want to say hello to everyone first!
I searched google and this forum for a similar problem, but wasn't successful
#! /bin/bash
I'm trying to output (echo) n lines of a text file to the screen (later into another file).
But I have problem with the sed command, it won't take the variable.
in the console I can use the following command to output a single line of a textfile:
for example:
sed -n -e '{1p}' filename
but now I want to use a variable with sed and echo the output
ECHO becomes important later when writing into a file, so the output is appended and not overwritten.
echo $(sed -n -e "$line_count"'p' $file_to_output)"
but sed has problems it doesn't understand that I want
<contenofvariable>p for example if $line_count is 3
echo $((sed -e '3p' $file_to_output)"
I tried for over two hours now with all different possibilities
I know it is possible, I did it a while ago, but can't find the old script anymore :-\
any ideas?
Thanks