0

How to select specific value with an array using awk.

Data

,,20160112,161521,139,

Example awk

awk -F "," '$3==`20160112` {print $3}'

Expectation is i want to select within the date range, not only single values, such like below. but below code is not working.

awk -F "," '$3==`201601[01-10]` {print $3}'

1 Answer 1

2

if your date format is fixed YYYYMMDD, this line should work for you:

awk -F, '$3>="20160101"&&$3<="20160110"{print $3}' file
Sign up to request clarification or add additional context in comments.

1 Comment

Are the quotes necessary?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.