Re: get the first word of a file
- From: "William James" <w_a_x_man@xxxxxxxxx>
- Date: 22 Dec 2005 07:42:01 -0800
William.Deans@xxxxxxxxx wrote:
> dufffman@xxxxxxxxx wrote:
> > Hi,
> >
> > I have a data file of the format
> >
> > 20051112|data|moreData|evenMoreData|..|
> > 20051112|data|moreData|evenMoreData|..|
> > 20051112|data|moreData|evenMoreData|..|
> > 20051112|data|moreData|evenMoreData|..|
> > 20051112|data|moreData|evenMoreData|..|
> > 20051112|data|moreData|evenMoreData|..|
> > 20051112|data|moreData|evenMoreData|..|
> >
> >
> > its going to be a pipe delimited file, w/the only the first date beng
> > the constant. in unix which command would i write to extract the first
> > '20051112' out of this file?
> >
> > Thanks,
>
> Greetings,
>
> I am not quite sure what you are asking.
>
> #to obtain the FIRST DATE ONLY
> cat data | sed s/\|.*// | head -1
sed can read a file. cat serves no purpose.
awk '{print $0 + 0 ; exit}' myfile
.
- References:
- get the first word of a file
- From: dufffman
- Re: get the first word of a file
- From: William.Deans@xxxxxxxxx
- get the first word of a file
- Prev by Date: Re: get the first word of a file
- Next by Date: Re: awk problem converting datafile
- Previous by thread: Re: get the first word of a file
- Next by thread: Re: get the first word of a file
- Index(es):
Relevant Pages
|