Timeline for How to prepend multiple lines to a file
Current License: CC BY-SA 4.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 29, 2019 at 23:29 | comment | added | user1330734 | @don_crissti Jeff's updated answer is what I was looking for 👍 I was not familiar with here documents before. | |
| Jan 29, 2019 at 23:19 | vote | accept | user1330734 | ||
| Jan 29, 2019 at 14:25 | history | edited | don_crissti | edited tags | |
| Jan 29, 2019 at 14:24 | comment | added | don_crissti | All the solutions given here or to the duplicate Q are using temporary files. That being said, Jeff Schaller's post now includes a solution that does exactly what you want: it inserts the text as-is via a here-document. | |
| Jan 29, 2019 at 13:44 | history | reopened | peterh G-Man Says 'Reinstate Monica' Inian terdon♦ bash Users with the bash badge or a synonym can single-handedly close bash questions as duplicates and reopen them as needed. | ||
| Jan 29, 2019 at 10:04 | comment | added | user1330734 | Thanks @JeffSchaller, but not quite as It fails for multiline entries. Please see the output at: imgur.com/a/XfvfDjH | |
| Jan 28, 2019 at 21:25 | comment | added | Jeff Schaller♦ | It seems to me that this answer unix.stackexchange.com/a/99351/117549 achieves that goal...? | |
| Jan 28, 2019 at 21:20 | review | Reopen votes | |||
| Jan 29, 2019 at 9:25 | |||||
| Jan 28, 2019 at 21:10 | history | edited | user1330734 | CC BY-SA 4.0 | added 153 characters in body |
| Jan 28, 2019 at 21:00 | history | edited | user1330734 | CC BY-SA 4.0 | Clarify question, want to be able to enter multiple lines of text verbatim to be prepended to file. |
| Jan 28, 2019 at 18:21 | history | closed | Jeff Schaller♦ Sparhawk don_crissti Christopher RalfFriedl | Duplicate of How can I prepend a tag to the beginning of several files?, How to insert text before the first line of a file? | |
| Jan 28, 2019 at 16:45 | comment | added | Thorbjørn Ravn Andersen | The reason that this is a problem is because it is the shell that does all the redirection work before starting cat (but without reading or writing anything yet) and it can detect that you will overwrite your file and gives an error. The solution is to use a program that can rewrite a file (perl -i comes to mind) and not the shell. | |
| Jan 28, 2019 at 11:40 | review | Close votes | |||
| Jan 28, 2019 at 18:21 | |||||
| Jan 28, 2019 at 11:24 | answer | added | Jeff Schaller♦ | timeline score: 5 | |
| Jan 28, 2019 at 7:50 | answer | added | Kusalananda♦ | timeline score: 7 | |
| Jan 28, 2019 at 7:34 | history | edited | user1330734 | CC BY-SA 4.0 | added some clarity and fixed punctuation error |
| Jan 28, 2019 at 7:26 | answer | added | Olorin | timeline score: 0 | |
| Jan 28, 2019 at 7:20 | answer | added | Inian | timeline score: 3 | |
| Jan 28, 2019 at 7:16 | history | asked | user1330734 | CC BY-SA 4.0 |