Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning AWK Programming

You're reading from  Learning AWK Programming

Product type Book
Published in Mar 2018
Publisher Packt
ISBN-13 9781788391030
Pages 416 pages
Edition 1st Edition
Languages
Author (1):
Shiwang Kalkhanda Shiwang Kalkhanda
Profile icon Shiwang Kalkhanda

Table of Contents (11) Chapters

Preface 1. Getting Started with AWK Programming 2. Working with Regular Expressions 3. AWK Variables and Constants 4. Working with Arrays in AWK 5. Printing Output in AWK 6. AWK Expressions 7. AWK Control Flow Statements 8. AWK Functions 9. GNU's Implementation of AWK – GAWK (GNU AWK) 10. Practical Implementation of AWK

Using the split() function to create arrays

The built-in split() function can parse any string into elements of an array. The split(string, arr, fs) function splits the string value of str into fields and stores them in the arr array. The number of fields produced is returned as the value of the split function. The string value of the third argument, fs, determines the field separator. The syntax of split() functions is as follows, followed by a listed explanation of the elements involved:

n = split (str, arr, fs)

  • str: This is the input string to be parsed into the elements of the named arr.
  • arr: This is the name of the array.
  • fs: This is the separator character based on which the array elements are split. If the separator is not given, the elements are split based on the fs as the separator. The separator can be a single character of the regular expression.
  • n: This is the index...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}