user9663282
user9663282

Reputation:

What does this bash script code do?

When use a script that will accept a file name, it starts and ends line numbers as arguments and displays all lines between the given line numbers.

What does following bash script code do ?

"sed -n $2,$3p $1"

Upvotes: 0

Views: 46

Answers (1)

Bret Weinraub
Bret Weinraub

Reputation: 2293

It seems the goal is to print some lines of a file and call the script,

first argument is the file, 2 argument is line to start with, 3 argument is line to finish with.

[script-name] [file-to-print-lines-from] [start-line] [end-line]

sed [number1],[number2]p [file]

Prints those line numbers from the file

Upvotes: 1

Related Questions