On Monday 16 April 2007 04:07:50 pm Eduardo Sanz Garcia wrote:
> I have a file like this:
> [arbitrary number of spaces]/37/[arbitrary number of
> spaces]/100/[arbitrary number of spaces]/95/
>
> I want to convert each arbitrary number of spaces into one tab:
> [tab]/37/[tab]/100/[tab]/95/
>
> How can I do this with sed?
> Thank you.
I'm not the greatest and regex, so for situations like yours I use
(g)awk. The command would be something like this:
awk '{ print "\t" $1 "\t" $2 "\t" $3 }' file
Make sure you keep all spaces. Awk is very particular about its
spacing. This will read each line and print it out, starting with a
tab, then "argument #1" (or the first word), another tab, argument 2,
etc.
Hope that helps. If you absolutely need sed, I can probably figure it
out.
--
Alberto Treviño
[EMAIL PROTECTED]
CID Testing Center
Brigham Young University
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list