Sigurdur Armannsson
asked on
How do I to put a tab into text in a text file using Terminal on a mac
When I use Terminal to find every job that has been worked on last 24 hours I get a text file with lines like this:
ABC 12345 Job Worked on
DEF 67890 Another Job etc...
As this can be up to 50 lines and I need to put this into two columns in Excel I need to add a tab in every line, after the numbers.
Like this: ABC 12345 <tab> Job Worked on
What do the experts think is the best way to do this?
ABC 12345 Job Worked on
DEF 67890 Another Job etc...
As this can be up to 50 lines and I need to put this into two columns in Excel I need to add a tab in every line, after the numbers.
Like this: ABC 12345 <tab> Job Worked on
What do the experts think is the best way to do this?
ASKER
Ok. That's how I do that in Text Wrangler, BBedit's little brother. I have never used sed before. Let's give it a try. Same GREP or what?
ASKER
man pages are not always that easy to learn by. Is it possible to get help with how I would implement this in sed?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot. :D
ASKER
This solution is what I was looking for. Besides being accurate it is explained well and will help me get started with using sed for future problems.
(\d+) and replace it with \1\t
That means find any single number repeated and replace it with the found number followed by a tab.
You can do it with the sed at the command line too