gawk - AWK - how to add the first line of the file? -


this command appends lines end of file

for in $(ls); awk 'begin{print "last_line"}' >> "$i"; done

how add lines beginning of file? tried so

for in $(ls); awk 'nr==1{print "first_line" }'1 "$i" > "$i"; done

use sed instead

[rdarji@indlin091 experiments]$ cat file2 line number: 2 line number: 3 line number: 4 line number: 5 [rdarji@indlin091 experiments]$ sed -i '1i\ > line number: 1' file2 [rdarji@indlin091 experiments]$ cat file2 line number: 1 line number: 2 line number: 3 line number: 4 line number: 5 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -