OT: sed problem

Daniela dgw at liwest.at
Sun Feb 1 06:37:06 PST 2004


On Sunday 01 February 2004 01:27, Robert Barten wrote:
> On Sun, Feb 01, 2004 at 01:38:44AM +0000, Daniela wrote:
> > I was wondering how I can do the following with sed (or another program):
> > 1. Output only the text from the start of the line to the first pipe
> > character 2. Output only the text between the last and the previous pipe
> > character Or, split the line at the pipe characters and assign the parts
> > to different shell variables.
>
> cat file | awk -F '|' '{print $1}'
>
> you may print $2 $3 $4 ... or NF (number of fields)

Great, thanks.




More information about the freebsd-questions mailing list