While reading results of a ls instance, I'm trying to display a specific term from a specific line using sed :
Here is what I managed to do until now :
echo $(ls -lAtro | sed -n '3p' | cut -d' ' -f 6 )
This is reading the 6th term of the 3rd line. What I'm trying to do is replace the '3p' by a more simple variable which would permit to do something like this :
linetoread=3
echo $(ls -lAtro | sed -n "$linetoread" | cut -d' ' -f 6 )
The above example doesn't work of course, but you get the idea. What can I do to achieve this ? Thanks in advance.