I wanted to replace the first line of a text with sed it should be like

sed -i.bak "1 s/^.*$/"CompoundState\tMethod\tApproach\tS^2\tEnergy\tPath"/" awk.xls

but I also need to run it on OSX but it doesn't support "\t" tab space is there an awk equivalent?

  • How about: '1 s/^.*$/CompoundState\tMethod\tApproach\tS^2\tEnergy\tPath/' ? – Runium Sep 1 '15 at 11:10

Some shells, including bash, allow you to type any literal character (e.g. Ctrl-I for Tab, Ctrl-M for Return) by prefixing it with Ctrl-V, so you could type Ctrl-V Ctrl-I instead of \t wherever it appears in your sed one-liner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.