[geeks] Quick sed question

Greg A. Woods woods at weird.com
Fri Jun 21 13:32:14 CDT 2002


[ On Thursday, June 20, 2002 at 15:32:41 (-0400), Joshua D Boyd wrote: ]
> Subject: [geeks] Quick sed question
>
> At least, I think sed is the best method.
> 
> Anyway, I have a file has 3 decimal numbers per line.  After the first
> number, there is a space between numbers.  Before the first number
> there is either no white space, or some amount of tabs and or spaces.
> I just want to	quickly strip the extra white space from the front of
> each line.

If I understand correctly (real examples would help! :-) either awk or
sed will do just fine, but awk will allow you to canonicalize all the
field separators too:

	# there's a space and a tab in the charset part of this expression:
	sed -e 's/^[ 	]*//'

	awk '{printf("%d %d %d\n", $1, $2, $3)}'

-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods at acm.org>;  <g.a.woods at ieee.org>;  <woods at robohack.ca>
Planix, Inc. <woods at planix.com>; VE3TCP; Secrets of the Weird <woods at weird.com>



More information about the geeks mailing list