quantik
quantik

Reputation: 816

Extract a substring from a text file using a positional argument

I extract the specific line with awk 'FNR == 6 {print $1}' infile.txt. Suppose this line is QWKEJQKSKMAOJISDKJFSDWESA. What should I pipe with awk in order to extract the characters in between the 10th and 15th positions of this string?

Upvotes: 1

Views: 75

Answers (1)

Ed Morton
Ed Morton

Reputation: 204259

print substr($1,10,6)

check the math depending what "between" means to you.

Upvotes: 2

Related Questions