cut on xenix?

Dominic Dunlop domo at riddle.UUCP
Fri Jan 29 21:18:45 AEST 1988


In article <116 at corum.UUCP> root at corum.UUCP (System Administration) writes:
>sigh... what is the equivalent function for "cut" on xenix?  i have a bunch of
>shell scripts that i ported over from a vax that has oodles of "cut"s in them.

Strange.  Cut's there on my XENIX (SCO 2.2.1 for the 80386), and I can't
recall it having been missing in recent older versions.  But anyway, if
you've got awk, you can use that instead of cut:

    cut -f2-7  is the same as  awk '{FS=OFS='\t'; print $1, $2, $4, $5, $6, $7}'

    cut -c2-7  is the same as  awk '{print substr($0, 2, 7-2+1)}'

Life gets slightly more interesting in the general case (-d: -f1-9,11,13-).
If you wanted to get flashy, writing a shell script -- or awk program --
to convert uses of cut to uses of awk wouldn't be too difficult.  But I'm
not volunteering...

If you're really desperate, you can use sed to isolate parts of lines.  For
example

    cut -c2-7  is the same as  sed 's/^.\(......\).*$/\1/'

    cut -f2-7  is the same as something possible, but very longwinded
-- 
Dominic Dunlop
domo at sphinx.co.uk  domo at riddle.uucp



More information about the Comp.unix.xenix mailing list