Adt
Adt

Reputation: 333

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.

Upvotes: 3

Views: 6118

Answers (2)

Felipe Hoffa
Felipe Hoffa

Reputation: 59175

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'

Upvotes: 8

Manos Parzakonis
Manos Parzakonis

Reputation: 158

You can use the --skip_leading_rows argument (source : Create a table from a file)

Upvotes: -3

Related Questions