"SigmaX asdf" <[EMAIL PROTECTED]> wrote:
> Yo;
>
> I have a series of comma-delimited text files with fourteen columns of
> data and several hundred rows. I want to use a short shell script to
> strip them of the last 9 columns, leaving the same file but with just
> five of its columns. I can do it in C++, but that seems like
> overkill. How would I go about doing it with sed or a similar
> utility?
Uh.. is there no reason the cut(1) program doesn't do this?
#!/bin/sh
cat file | cut -d',' -f1-5 > /tmp/t.$$
rm -f file
mv /tmp/t.$$ file
This doesn't preserve permissions, etc... but - it's pretty
straight-forward.
- Dave Rivers -
--
[EMAIL PROTECTED] Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"