One liner command for Awk to insert a new string or text at a specific line number on a file.
awk 'NR==3{print "new line text at row 3"}1' original_file.txt > modified_file.txt
'NR==3 --insert string or data at line number 3
"}1' -- number 1 (can be any number) means to append the new text or string
> modified_file.txt -- redirect the output to a new file
To find out more, type this at the terminal.
info awk
info print
man awk
man print
Or you can redirect the output of info and man to a file for offline viewing.
Check out links below for other examples of awk command.
http://quickbytesstuff.blogspot.sg/2016/02/linux-awk-simple-example.html
http://quickbytesstuff.blogspot.sg/2016/05/basic-awk-usage-tutorial.html
=================
Catholic Rosary Guide for Android:
Pray the Rosary every day, countless blessings will be showered upon your life if you recite the Rosary faithfully.
https://play.google.com/store/apps/details?id=com.myrosaryapp
https://play.google.com/store/apps/details?id=com.myrosaryapp
Comments
Post a Comment