Thursday, March 23, 2017

Bash: sed - part X

Reading data from a file




The read command (r) allows you to insert data contained in a separate file.

[address] r filename




# cat Browncoats.txt

Blum, R         Browncoat
Bresnahan, C    Browncoat






# sed '3r Browncoats.txt' data6.txt




This is line number 1.
This is line number 2.
This is line number 3.
Blum, R         Browncoat
Bresnahan, C    Browncoat
This is line number 4.




----------------------------------------




# sed '$r Browncoats.txt' data6.txt



This is line number 1.
This is line number 2.
This is line number 3.
This is line number 4.
Blum, R         Browncoat
Bresnahan, C    Browncoat

No comments:

Post a Comment