New answers tagged printf
1
vote
Inserting text with formatting at the start of a file with printf
What I would do, using sponge from moreutils:
{
printf 'Anything\tyou\twant\tto\tadd'
cat file
} | sponge file
or in a one-liner:
{ printf 'Anything\tyou\twant\tto\tadd'; cat file; } | sponge
...
Top 50 recent answers are included
Related Tags
printf × 293bash × 132
shell-script × 48
awk × 42
shell × 37
echo × 37
text-formatting × 22
linux × 17
text-processing × 17
sed × 16
find × 15
zsh × 10
scripting × 9
escape-characters × 9
newlines × 9
command-line × 7
variable × 7
numeric-data × 7
c × 6
ksh × 6
posix × 6
columns × 6
dash × 6
pipe × 5
quoting × 5