Hacker News new | past | comments | ask | show | jobs | submit login

The old line editor, ed, is good at this for files. I assume you could tinker a bit to get stdin support.

  echo -e "0r header.txt\nw" | ed spreadsheet.csv



Replying to my own post, looks like ex is more straightforward.

  ex -sc '0r header.txt' -c wq spreadsheet.csv
And ugly, but works for stdin:

  echo "whee" | ex -sc '0r /dev/stdin' -c wq somefile




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: