On Mac OSX how do I add a line to a file using sed when the file is empty? -


यह ठीक काम करता है

  $ sed -i '' '1i \ my text' $ होम / .bashrc  

जब एक पंक्ति एक होती है, लेकिन जब कोई रेखा नहीं होती है तब कोई प्रभाव नहीं होता है।

एक ही रास्ता, दोनों ही मामलों में काम करेगा:

  {मेरे टेक्स्ट को गूंज; बिल्ली फ़ाइल; } | टी फाइल  

बड़ी फ़ाइलों के लिए यह काम बड़ी फ़ाइलों के लिए, एक अस्थायी फ़ाइल का उपयोग करें:

  {मेरे टेक्स्ट को गूंज; बिल्ली फ़ाइल; } & Gt; अस्थायी $$ & amp; amp; एमवी अस्थायी $ $ फ़ाइल  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -