using /usr/bin/cut in scripts...

Dave Hammond daveh at marob.masa.com
Sun Jul 29 11:51:59 AEST 1990


In article <19253 at well.sf.ca.us> Brian Lawrence Dear writes:
>
>          gid=`/usr/bin/cut -f3 -d: /etc/group|sort -n|tail -1`
> 
>Thing is, the /usr/bin/cut command is not available on everyone's
>SCO XENIX machine.[...]
>
>So.. my question is, is there an alternative to the script
>above that I can use and rest assured it'll work on all SCO
>XENIX 386 platforms, to add a new group as described?

One alternative is awk.  Replace "/usr/bin/cut -f3 -d:" with
"awk -F: '{print $3}'":

          gid=`awk -F: '{print $3}' /etc/group|sort -n|tail -1`


Another alternative is to get the public domain version of cut from
your local comp.sources archive.

--
Dave Hammond
daveh at marob.masa.com
uunet!masa.com!marob!daveh



More information about the Comp.unix.wizards mailing list