335 reputation
311
bio website
location
age
visits member for 2 years, 1 month
seen Dec 10 at 13:12

Dec
9
accepted Insert text from file inline after matching pattern in another file
Dec
9
comment Insert text from file inline after matching pattern in another file
brilliant, thanks for the help!
Dec
9
comment Insert text from file inline after matching pattern in another file
Ok, that worked, but the JSON is getting inserted right BEFORE the pattern now: awk '/First/ { while(getline line<"File1.txt"){print line} }1' infile.txt
Dec
9
comment Insert text from file inline after matching pattern in another file
The actual JSON does not need to be altered, I want to insert the JSON after the pattern so that there is not a newline between the pattern and the start of the JSON.
Dec
9
comment Insert text from file inline after matching pattern in another file
@mikeserv Thanks for the help. I'd happy to try your solution, but after reading your solution, I'm not sure how to implement what you suggest. Can you post an example?
Dec
9
comment Insert text from file inline after matching pattern in another file
Added an example JSON data file that does not insert correctly for me.
Dec
9
revised Insert text from file inline after matching pattern in another file
added 417 characters in body
Dec
9
comment Insert text from file inline after matching pattern in another file
In my actual use case, I'm inserting a large JSON file and this awk example doesn't work. I just get a single left brace, [ inserted after the pattern match. Normal text works fine, but not JSON?
Dec
9
revised Insert text from file inline after matching pattern in another file
added 25 characters in body
Dec
9
asked Insert text from file inline after matching pattern in another file
Sep
23
awarded  Notable Question
Sep
16
awarded  Popular Question
Aug
6
awarded  Notable Question
Jul
2
awarded  Curious
Feb
25
awarded  Popular Question
Jan
20
accepted How can I use tee to print the input stream?
Jan
19
comment How can I use tee to print the input stream?
Ideally, I'd like to print the results of tee to stdout and have it appear before the results of my perl script.
Jan
19
asked How can I use tee to print the input stream?
Jan
2
comment How can I find and/or print sudo's lecture file?
Yes, in theory, this is exactly what I'm looking for; however, I do not get this output on Ubuntu or OS X.
Jan
2
comment How can I find and/or print sudo's lecture file?
It shows a bunch of text. Here's a sample: --prefix=/usr -v --with-all-insults --with-pam --with-fqdn --with-logging=syslog --with-