简体   繁体   中英

Batch: trimming an output of a sql file processed in batch

Batch:

db2 -stwl%LOG% -f %SQL_DIR%\test.sql > %DATA_ROOT%\%NAME%.txt

SQL: pretty long so i won't post it here, its a huge select query that gives this output:

1                                                                                                                                                                                                                             

-----------------------------------------------------------------------------

A testline for example  <--these are the only lines i want to output            
and another one      <-- these are the only lines i want to output                                                           



  2 Satz/Sätze ausgewählt.

Is there a way to minimize the output into the txt file to just the 2 lines i marked above? (without using some extra perl/other external code)

maybe something like another character in the db2 call to just print the 2 rows

You might want to take a look at db2batch and its output options.

  • Performance option should be 0 (zero)
  • Query option should be on

Take a look at the db2batch manual for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM