assuming you will have a space as the delimiter for your data ...Quote:>Hello.
>Could someone please tell me
>how I could use sed or awk
>to strip a file of all but
>it's first column?
>e.g.
> i want a dog i
> don't want a cat ===> don't
> scratching it's claws scratching
> all over my back all
here it is in AWK.
AWK script would be ...
{ print $1 }
and then you would execute this on the command-line ...
AWK -f [script file] [data file] > output.file (if you want to save the
output)
note: there are other elegent ways of doing the above, but this
example is probably the easiest way to think about it.
-Bob-
Bob Angell | Data Integration (multi-platform)
Principal, Management Systems Engineer | Health Systems Engineering
Applied Information & Management Systems | Database design/development
1238 Fenway Avenue - SLC, UT 84102-3212 | Simulation/Modeling/Neural Nets
[Standard Disclaimer: Speaking for the University of Utah, NOT!]