in reply to Replace first blank line in a text file with headers.
If you find that the only place your text file could possibly have an empty line and you don't mind changing the file in place, feel free to use this one-liner (where filename.txt is the name of your text file):
perl -i.tmp -lpe "s/^\s*$/Name,City,State,Zip/g" filename.txt
Cheers,
Shadowsong
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace first blank line in a text file with headers.
by FreeBeerReekingMonk (Deacon) on Mar 24, 2016 at 17:49 UTC |