akiilhan
akiilhan

Reputation: 179

How can i use awk command in csv files

in our csv names contain year,month,date,hour, minutes like: abc_202002111500.csv so we have many csv files for every time.

if i want to search the number that 1234 in december 02 2020 at between 15:00 -15:59;

awk -F"|" '{if ($3 == 1234) print $5}' abc_2020021115*.csv

So what if i want to write same number same date but between 15:00 -17:00 ?

awk -F"|" '{if ($3 == 1234) print $5}' abc_20200211?????.csv

Upvotes: 0

Views: 161

Answers (2)

Daweo
Daweo

Reputation: 36873

If you wish to do file-filtering in GNU AWK you might harness BEGINFILE and nextfile for that.

Upvotes: 0

mr. fixit
mr. fixit

Reputation: 1562

The answer relies on a feature of most shells, search for shell wildcard range for details.

In your case, instead of abc_2020021115*.csv, use abc_202002111[56]*.csv

Upvotes: 2

Related Questions