Skip to main content
8 events
when toggle format what by license comment
Mar 26, 2018 at 19:30 comment added RACKGNOME The question was edited for clarification and generality. You have not given a sufficient solution for it to be considered. Thanks.
Mar 22, 2018 at 21:59 comment added user1404316 @RACKGNOME : The thing to do isn't to wish me cheers, but to mark the check mark next to the answer, as accepted. Also, question URL pages on this site are supposed to be static one-off events, for the benefit of others who use search engines; they aren't supposed to be running continuous support requests or collaboration forum, so your "reworking" undermines a major purpose of the site, which is to allow people (like me) to get answers by googling, without needing to ask.
Mar 22, 2018 at 20:37 comment added RACKGNOME is there anyway in awk to insert things around matching phrases like in sed? Also if you could kind of give more concrete examples to exemplify your description that be awesome (and upvotable!). I've also reworked the question and given my solution that uses awk as you suggest. Cheers
Mar 6, 2018 at 4:08 comment added user1404316 @RACKGNOME - it seems you didn't grok from the answer that once you modify the RS, awk automatically assigns all elements to its positional parameters $1... and the entire paragraph as $0, so you now can do anything multi-line you want within that paragraph using all of awk's powerful features.
Mar 6, 2018 at 4:04 comment added user1404316 @RACKGNOME - yep, it is just you (joke). To delete a "paragraph" - well, once a "paragraph" is just a record, you could just not print it upon a test of your decision or since it now is a variable, ie. $0, you could $0="" for a blank line, or do whatever else. Once you have changed the RS value, you can include newline characters in your regex searches, or remove them and have your searches traverse strings.
Mar 6, 2018 at 2:20 comment added RACKGNOME So it's probably just me but I don't see how this will allow for deleting the paragraph. I guess also I already am using an awk command to search the existing file for a paragraph containing both "Host $COMPUTER" (or "Match originalhost $COMPUTER..." and "User $USER". I'll edit and give my GET_CONFIG_PARAGRAPH function. I guess also for stackoverflow's benefit it would be really useful to know how to 1.) find and delete a multi-line string stored in a variable and/or 2.) use sed or awk to find a multi-line string
Mar 5, 2018 at 2:56 history edited user1404316 CC BY-SA 3.0
add info on RS being a regex
Mar 5, 2018 at 2:29 history answered user1404316 CC BY-SA 3.0