خرید بک لینک

Vote count: 0

Hi I have the following file

+--------------------------+-----------------------+-----------------------+- +
|         col_name         |       data_type       |        comment        |
+--------------------------+-----------------------+-----------------------+--+
| id                       | string                |                       |
| name                     | string                |                       |
| filename                 | string                |                       |
| loaddate                 | string                |                       |
| recordid                 | string                |                       |
|                          | NULL                  | NULL                  |
| # Partition Information  | NULL                  | NULL                  |
| # col_name               | data_type             | comment               |
|                          | NULL                  | NULL                  |
| fname                    | string                |                       |
+--------------------------+-----------------------+-----------------------+--+

I would like to create this output

id,name,filename,loaddate,recordid

Basically column names with comma separated list except the header, footer and partition info.

Used two awk s and a paste to achieve the desired output and used paste to create one line, used a temp file.

awk 'NR>3 {l[NR] = $0} END {for (i=1; i<=NR-3; i++) print l[i]}' g.txt > t.t
awk '{if (substr($2,3,1) != "") print $2}' t.t | paste -s -d ,

the question is how can I do this in one line of command?

asked 20 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 12 فروردين 1395 ساعت: 6:26

صفحه بندی