Techne

A practical knowledge base

User Tools

Site Tools


bash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
bash [2026-03-30 09:47:05] hyperrealbash [2026-03-30 09:47:25] (current) hyperreal
Line 1: Line 1:
 ===== Print nth line from file ===== ===== Print nth line from file =====
  
-<code shell>+<code bash>
 sed 'Nq;d' file.txt sed 'Nq;d' file.txt
 </code> </code>
Line 7: Line 7:
 ===== Prepend text to beginning of file ===== ===== Prepend text to beginning of file =====
  
-<code shell>+<code bash>
 echo "new content" | cat - file.txt > temp echo "new content" | cat - file.txt > temp
 mv temp file.txt mv temp file.txt
 </code> </code>
  
-<code shell>+<code bash>
 sed -i '1s/^/new content\n/' file.txt sed -i '1s/^/new content\n/' file.txt
 </code> </code>
bash.txt · Last modified: by hyperreal

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain