SLUG Mailing List Archives
Re: [SLUG] Extracting string from a file - shell script
- To: Kyle <kl@xxxxxxxxxxx>
- Subject: Re: [SLUG] Extracting string from a file - shell script
- From: Phil Scarratt <fil@xxxxxxxxxxx>
- Date: Fri, 03 Jul 2009 10:05:09 +1000
- Cc: slug <slug@xxxxxxxxxxx>
- User-agent: Thunderbird 188.8.131.52 (X11/20090608)
> Hi Folks,
> I am trying to extract a substring from a string found in a file.
> The string is: *** End of TF0220 at Thu Jul 2 10:06:51 EST 2009 -
> RC = 0
> and the substring I want to extract is TF0220. This is a program name
> and the length of this name varies. In other words I want to extract
> whatever is between the words "of" and "at" in a script.
> How would I likely go about that please?
Something like this would work:
cat <file> | perl -nle