| Nils O. Selåsdal 2006-02-26, 10:16 am |
| Savte wrote:
> Hi everyone,
>
> Does there exist any way under shell programming to capture a line (say
> line 13 ) and save it
> to a string and manipulate? As an example of the functionality that i
> am looking for:
> Suppose you a terminal with display like this:
>
> Hello everyone
>
> Unix Shell Scripting
>
> When i run my script, i would like to get line 3(displayed ) and save
> it to string for further manipulation.
I'm not quite sure where the text you want to get is, if it's the
output of a command you could get it like e.g.
theprog | head -13 |tail -1
or to put it in a sh variable 'var'
var=$(yourprog | head -13 |tail -1)
echo $var
This won't be very effective if it's a large lineno, not
something small as line 13
There's probably more elegant solutions in awk/sed/perl/etc. for that.
|