Sed, awk practical application

1. Add a header record to the data file

sed '1i\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' test.dat > tmp.dat

 

2. Add a column to the data file (file separator is' | ', add the first column to the last column)

awk -F'[:|]' '{print $0,$1}' OFS="|" test.dat > test.dat.ok

awk -F'[:|]' '{print $0,"free style",$1}' OFS="|" test.dat > test.dat.ok

Guess you like

Origin blog.csdn.net/sjmz30071360/article/details/83629539