From: Doug Chapman USG <please.dont.send.mail@just.post.to.news>
Subject: Re: Awk
Date: 1998/11/20 [thread overview]
Message-ID: <3655C507.A24DEC49@just.post.to.news> (raw)
In-Reply-To: 733tj8$meo$1@hdxf08.telecom.ptt.nl
GJH wrote:
>
> for example a string : 'thisisastring' where I want the first four
> characters : this.
>
Sed works nicely:
echo thisisastring | sed 's/\(....\).*/\1/'
The \(....\) part means save the first 4 characters (due to the for . )
The .* just matches the rest of the string
The \1 means write out what was matched by what was in the
first set of \( \)
- Doug
next prev parent reply other threads:[~1998-11-20 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-20 5:00 Awk GJH
1998-11-20 5:00 ` Awk Nikola Milutinovic
1998-11-20 5:00 ` Doug Chapman USG [this message]
1998-11-20 5:00 ` Awk Doug Chapman USG
1998-11-22 5:00 ` Awk Nikola Milutinovic
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox