/ / Perl का उपयोग कर फ़ाइल संपादन [बंद] - perl

Perl [बंद] का उपयोग कर फ़ाइल संपादन - perl

मेरे पास एक बड़ी फाइल है (20,000 से अधिक लाइनें हैं) जहां कुछ पंक्तियां "+" के साथ घूम रही हैं। यह फॉर्म का है:

This is a file with many lines
Some lines start with plus
+ line one
+ line two
Some lines do
not start with plus
+ line three
+ line four

मैं पिछली लाइन के साथ + से शुरू होने वाली सभी लाइनों में शामिल होना चाहता हूं। तो मेरा आउटपुट इस तरह दिखना चाहिए:

This is a file with many lines
Some lines start with plus line one line two
Some lines do
not start with plus line three line four

मैं इसे पर्ल के साथ कैसे कर सकता हूं?

उत्तर:

उत्तर № 1 के लिए 1

इन-प्लेस फ़ाइल संपादित करें,

perl -i -pe "BEGIN{ $/ ="n+" } chomp" file