Reputation: 5044
I have the following file
100843 stars n30 2012-03-08 spartanico83
stars n50 2009-11-28 babepy
stars n05 2009-03-09 sandfox
stars n20 2014-01-17 yeuce
My aim is to have that:
100843 stars n30 2012-03-08 spartanico83
stars n50 2009-11-28 babepy
stars n05 2009-03-09 sandfox
stars n20 2014-01-17 yeuce
I have tried to use column -t
as a command line but it gives me that
100843 stars n30 2012-03-08 spartanico83
stars n50 2009-11-28 babepy
stars n05 2009-03-09 sandfox
stars n20 2014-01-17 yeuce
Should I use a combination of awk
and sed
as well?
Thanks
Upvotes: 0
Views: 65
Reputation: 97948
Put a tab with sed:
sed 's/^\([ ]*stars\)/\t\1/' input
or use sed/column for a more robust solution:
sed 's/^\([ \t]*stars\)/@\1/' input | column -t | sed 's/^@/ /'
Upvotes: 0
Reputation: 781004
This can be done just using sed
:
sed -r 's/^ +/ /'
If the line begins with spaces, replace the initial spaces with 12 spaces.
Upvotes: 2