question about sed

Hi all,

I have a text file of the following format, i.e.

 
        EMC Documentum idql - Interactive document query interface
        (c) Copyright EMC Corp., 1992 - 2008
        All rights reserved.
        Client Library Release 6.5.0.118 Hotfix built on 06/30/2009

Connecting to Server using docbase mydocbase
Connected to Documentum Server running Release 6.5.0.143 SP1 AIX.Oracle
1> 2> count(dmi_workitem.r_object_id)
-------------------------------
                          24435
(1 row affected)
1> 2>

What my intention is to get only the number, in this case (24435). This number can be 5 and it can be sometimer 50000. I have tried the following sed command, but with no luck. Can you please advice how to do this?

sed -e '/^[0-9]\$/ !d' -e 's/.*/&/' < input.txt > output.txt

With awk:

awk '/---/{getline; print $1}' file

Franklin,

Thanks alot mate. It just did the trick.

So, how it worked is the awk searched for the string "---" and printed the line after it?

Right! :slight_smile:

Thanks for prompt reply. Appreciate it. :slight_smile:

sed -n "/---/{n;p;q;}" file