-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possible direction? #1
Comments
Sorry I've been quite busy with work. You've presented an interesting idea here. I have one question from my initial read-through:
Why here does it say s||fi|ll* ...? Thanks On Fri. 12 Sep.2014, at 7:03 AM, mikeserv notifications@github.com wrote:
|
Thanks for replying! I was afraid I had offended and so didn't pursue it further. In any case - that's just to demonstrate that the You know what though? I made that edit afterward and didn't include the literal bit in the correct input section... I'll edit it now to show it... And, while I think that all of these could be done with a |
I brought it along some today. Here's a link to a working copy. Well, working to some point anyway. As of now I can:
...or...
and get...
Or just one or the other for only the relevant sections. In its current form it doesn't distinguish because it's looking for section headings, so...
gets...
Each of those lines is a positional parameter - the first line in
And then when I do...
I get....
|
I brought it further still. It now ensures its arguments are uppercased - it's a little native shell function I had from something else. It also translates long options to short every time. This is good because that we can let
...can all work the same.
...or...
|
So, we talked about this the other day. I actually got back in the chat room last night, though I don't think you've seen it - (your profile indicates you haven't logged in since)...
Anyway, here is a really rough 1/4 way there
sed
implementation - (updated):I read your updated notes this morning - and I think I'm beginning to understand better. I'll be honest about this - my hope is that doing this would help me to learn to use
git
. I don't know how - and I'd really like to. This is probably obvious considering I posted this as an issue. While that may be true - it's not your issue but mine. Yours works - this doesn't... yet. I'm hoping we can help each other - because I really am very good withsed
and portable shell-script, but not much else.This update actually does less than before. It does not print working
sed
script. It parses a config file and prints something very near tosed
script that should be easily transformable depending on intended action. Given the following input:It prints...
Basically it wants input like:
where SECTION replaces the first @ character on any SEARCH_VALUE line.
On ###SECTION### and SEARCH_VALUE lines all whitespace is removed.
There can be multiple "replace value" lines per SEARCH_VALUE.
On "replace value" lines all characters before the first and following the last " are removed
So the leading whitespace there doesn't matter. Blank lines are ignored.
In fact, all lines not beginning w/ 3 hashes, or containing a @ or at least two " are ignored.
All lines, that is, but a line beginning with a single # and containing any amount of trailing whitespace.
Those lines serve to delimit each SECTION
Oh, and for SECTION lines the trailing hashes are optional - they don't matter.
Any line not within a ###SECTION through ^#$ range is ignored - even if it happens to match one of those 3 types of lines that aren't ignored.
And any lines within that range that begin with a hash are ignored as well - even if they contain two or more quotes and/or a @.
Probably you can see where my fatal flaw was though with the (SEARCH/replace) labels - those need to be interchangeable. I believe I am working toward that.
I am very interested to know what you think though - as, again, my understanding it admittedly limited. Do you think it could be a workable direction?
My roughly imagined workflow looks like:
sed
/grep
to select only relevant SECTION ranges in config file.sed
which translates its input into workingsed
scriptsed
reads it as a script and performs file edits as necessary.The text was updated successfully, but these errors were encountered: