Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove header from query result in bq command line

I have a query $(bq query --format=csv "select value from $BQConfig where parameter = 'Columnwidth'") .

The output of the query in csv format is :

value 3 4 6 8

here i want to get only the result 3 4 6 8 not the value which is just a header.

I have gone through google document and found that --noprint_header works only for bq extract. i didnt find anything for bq query.

like image 302
Adt Avatar asked Oct 21 '25 04:10

Adt


1 Answers

If you are on a bash shell, you could use sed or awk to skip the first lines:

 bq query --format=csv "SELECT 1 x" | sed "2 d"

Or:

 bq query --format=csv "SELECT 1 x" | awk 'NR>2'
like image 99
Felipe Hoffa Avatar answered Oct 24 '25 04:10

Felipe Hoffa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!