sed: Remove lines

I wanted to remove the first and last lines of a text file that ends each line with a newline. This is because they are delimiters an unnecessary. I suggest you use sed

Example input

First Start
Important line 1
Important line 2
File End

Command: sed '1d; $d' input_text_file

  • d - Delete this line
  • $ - Last line of file
  • 1 - First line of file
  • ; - End command and prepare for next

Now combine the inputs and send to clipboard

Command: sed '1d; $d' input_text_file | tr -d '\n' | xclip -sel clip

Output: Important line 1Important line 2