Thread: grep command

grep command

From
"Kuriakose, Cinu Cheriyamoozhiyil"
Date:
Hi All,

I am giving the command

cat config.log|grep -w 'PG_VERSION'

Which gives the following Output:

| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
| #define PG_VERSION "8.3beta2"
#define PG_VERSION "8.3beta2"

But the output that I would require is

PG_VERSION "8.3beta2" that should occur only once, can anyone please
tell me the command to get this output.

Thanks in advance

Regards
Cinu Kuriakose


Re: [HACKERS] grep command

From
Andrew Dunstan
Date:
Leaving aside the question of why one might want to do this, Unix 101
should show you many ways to do it. For example,

sed -n -e 's/.*PG_VERSION /PG_VERSION /p' -e /PG_VERSION/q config.log

Please don't cross-post questions like this, especially when it's not
really a PostgreSQL question at all.

cheers

andrew

Kuriakose, Cinu Cheriyamoozhiyil wrote:
> Hi All,
>
> I am giving the command
>
> cat config.log|grep -w 'PG_VERSION'
>
> Which gives the following Output:
>
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> #define PG_VERSION "8.3beta2"
>
> But the output that I would require is
>
> PG_VERSION "8.3beta2" that should occur only once, can anyone please
> tell me the command to get this output.
>
> Thanks in advance
>
> Regards
> Cinu Kuriakose
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>
>

Re: [HACKERS] grep command

From
"Medi Montaseri"
Date:
Or ... ask the application not the OS  ....

psql> select version() ;

Cheers
Medi

On 10/29/07, Andrew Dunstan < andrew@dunslane.net> wrote:

Leaving aside the question of why one might want to do this, Unix 101
should show you many ways to do it. For example,

sed -n -e 's/.*PG_VERSION /PG_VERSION /p' -e /PG_VERSION/q config.log

Please don't cross-post questions like this, especially when it's not
really a PostgreSQL question at all.

cheers

andrew

Kuriakose, Cinu Cheriyamoozhiyil wrote:
> Hi All,
>
> I am giving the command
>
> cat config.log|grep -w 'PG_VERSION'
>
> Which gives the following Output:
>
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION " 8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> | #define PG_VERSION "8.3beta2"
> #define PG_VERSION "8.3beta2"
>
> But the output that I would require is
>
> PG_VERSION "8.3beta2" that should occur only once, can anyone please
> tell me the command to get this output.
>
> Thanks in advance
>
> Regards
> Cinu Kuriakose
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>
>

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster