Hello,
i'm trying to print specific lines from a file using only one command
for example:
a file contains 30 lines , i wish to print the content of lines 13, 14, 15, 16??
what command to use for that?

Thx for the quick answer Salem.
i looked the man pages for those command, but couldnt figure out how to use them for my purpose.
could you add an example on one of those commands?

sed with the -n option and the "p" "operator". Try reading the man page for sed again, then post your attempt here.

i actually did read the man pages but couldnt understand anything from this:
-n, --quiet, --silent
suppress automatic printing of pattern space.

i've tried the following and it worked for my example:
sed -n 13,16p file

from what i understand it prints the given range?
What if i want to print random lines that arent one after the other, is that possible?

Well, that's what you do. Take a look at the manual again, and see what other types of "patterns" that you can use in the same position that you currently have "13,16".

We're only going to throw you so many bones before we expect you to start reading the manuals and figuring out how to do this stuff.

In fact, just go read the manuals. No, you won't remember the details, but you'll probably remember enough to recognise that you might have read something like the answer to your problem before.
Then you go on a more detailed hunt to find exactly what you're looking for.

If you can remember roughly what each tool is capable of, then you can RTM to find out the detail when you need it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.