Quantcast
Channel: Parse file with Awk only when first row matches pattern - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 4

Parse file with Awk only when first row matches pattern

$
0
0

I need to interrogate the header of a CSV file, and if a column exists proceed with the data rows. Context is when the data contains columns depending on when and what emitted it.

Hoping for a "pure" Awk solution to keep business logic in a common language, but if this is not possible, interested in approaches that selectively deliver files with the header match to the Awk script.

Using latest version of Gawk is always an option.

Edit to add pseudo code:

if column in header (NR==1): then proceed with rest of file, else stop processing file


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images