Linked Questions

1 vote
2 answers
3k views

file contents: # cat file.txt ----- MATCH ----- MATCH ----- MATCH ----- # cat text.txt add this text file before first match sed commands: # sed '0,/MATCH/r text.txt' file.txt ----- add this text ...
Zell's user avatar
  • 147
0 votes
1 answer
1k views

I write a bash script to replace the keyword with the whole content of another file. Here is the command I use: sed -i "s/CONTENT/$(cat $pathB)/" $pathA A file Here is my introduction: ...
Azreal's user avatar
  • 43
1 vote
1 answer
54 views

I was wondering how to print the contents of a file above the occurrence of a pattern in another file. I know that using sed -n '/^PATTERN/i\\ INSERTING' filename would insert above the pattern but ...
NOOBCAKE's user avatar
57 votes
4 answers
105k views

I have two files: file1 and file2. file1 has the following contents: --- host: "localhost" port: 3000 reporter_type: "zookeeper" zk_hosts: - "localhost:2181" file2 contains an IP ...
Jay Kah's user avatar
  • 571
9 votes
3 answers
10k views

I'm trying to take the contents of a file and insert it after a matching pattern in another file using sed. My question is very similar to this question, but I wish to insert the contents of a file ...
turtle's user avatar
  • 2,777
5 votes
3 answers
2k views

This question and its answers show the content of an existing file ("processedFile") can be inserted into another existing file ("receivingFile") before one of its patterns inside, such that: sed -i -...
Herpes Free Engineer's user avatar
0 votes
2 answers
840 views

I have a file uca.xml (Thunar configuration for custom actions): <?xml encoding="UTF-8" version="1.0"?> <actions> <action> <!--some code--> </action> </actions>...
mDfRg's user avatar
  • 3
2 votes
2 answers
479 views

I have one file that contains the following: 10.48.29.68 doggy 10.65.8.184 kitty 10.48.15.104 froggy I need to insert the contents of this file into my hosts file after the line bc group in the hosts ...
Varun Dogra's user avatar
1 vote
4 answers
214 views

This assistance was helpful, but I am still a bit lost. I'll steal it's super easy format. How to insert the content of a file into another file before a pattern (marker)? I have two files. File 1 ...
JJJ's user avatar
  • 13
0 votes
3 answers
652 views

following older posts (How do I use vim on the command line to add text to the middle of a file? & How to insert the content of a file into another file before a pattern (marker)?), I have a more ...
Ariel's user avatar
  • 101
1 vote
1 answer
153 views

Suppose I have 3 files: index.html And here is foo: <!-- include: includes/foo.html --> This can be done similarly: <code> <!-- include: includes/bar.txt --> </code> includes/...
wjwrpoyob's user avatar
  • 460