mabman has asked for the wisdom of the Perl Monks concerning the following question:
What I want to do is search a text file for a line (or rather a part of a line), and then insert another line of text directly above it, after what is already entered there.
For instance, the text file might say:
(Settings)
foo=1
(baz-123)
and I want to ultimately end up with is:
(Settings)
foo=1
bar=2
(baz-123)
Also, the last line may change from file to file, eg, it may be (baz-456) or (baz-678) or whatever, but the "(baz" will be constant.
Thanks in advance,
Glenn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: insert line of text above a line
by Limbic~Region (Chancellor) on Sep 25, 2003 at 22:41 UTC | |
by mabman (Novice) on Sep 25, 2003 at 23:04 UTC | |
|
Re: insert line of text above a line
by BrowserUk (Patriarch) on Sep 25, 2003 at 23:17 UTC | |
by graff (Chancellor) on Sep 26, 2003 at 03:14 UTC | |
by BrowserUk (Patriarch) on Sep 26, 2003 at 09:02 UTC | |
|
Re: insert line of text above a line
by Fletch (Bishop) on Sep 26, 2003 at 01:36 UTC | |
|
Re: insert line of text above a line
by flounder99 (Friar) on Sep 26, 2003 at 02:33 UTC | |
|
Re: insert line of text above a line
by BUU (Prior) on Sep 25, 2003 at 22:42 UTC | |
by Anonymous Monk on Sep 25, 2003 at 22:57 UTC | |
by Anonymous Monk on Sep 26, 2003 at 12:29 UTC |