Posix Compliance [Was Re: Glibc-2.3.3 tarball]

Steve Martin srm at netcomuk.co.uk
Sat Jan 17 05:53:28 PST 2004


On Fri, 2004-01-16 at 19:40, Michael Brömer wrote:
<snip>
> I did some minor changes to what you did, like
> sed:
>    \(uniq -d\|uniq\) instead of \(uniq\)
>    added s@\(uniq\) +\([1-9][0-9]*\)@\1 -s \2 at g;
>    handle "od" at the beginning of a line and do not delete a leading " "
> grep:
>  " od -[sw]" to prevent finding chmod -w
>  "^od -[sw]"  to find od on the beginning of a line
>  "expand" covers "unexpand"
>  "uniq -d -[0-9]" added (vim?)
>  "sort +[0-9]" would find "sort 1>&2" (texinfo?) -> "sort [+][0-9]"
> 
> In case anyone wants it...
> 
This handles sort quite well
	    's/\(sort\) +\([0-9]\+\) -\([,0-9]*\)/\1 -k \2,\3/g'
	    's/\(sort\) +\([0-9]\+\)/\1 -k \2/g'

but sort is a little more complex as the we have to handle the following
syntax:
	sort +0.3 -0.5

which needs to trnslate to:
	sort -k 1.4,1.6

as the first position is 0 in the old syntax but 1 in POSIX2, needs at
least an awk script methinks....

> When i fiddled with this i did not find examples of the now invalid
> usage of the multiplier suffixes [bkm] for "tail" and "head" that 
> Ryan mentioned. "tail -n 1b" is valid, but what were those suffixes
> used to be used like?
> 
This handles the [bkm] suffix stuff:
	's/\([(head)(tail)]\) -\([0-9]\+[bkm]\)/\1 -c \2/g'
	's/\([(head)(tail)]\) +\([0-9]\+[bkm]\)/\1 -c +\2/g' 
-- 
Steve Martin <srm at netcomuk.co.uk>

Still can't think of anything witty to write here.



More information about the lfs-dev mailing list