Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

String manipulation functions in awk

The language of awk includes many built-in string manipulation functions:

  • length(string): This returns the string length.
  • index(string, search_string): This returns the position at which search_string is found in the string.
  • split(string, array, delimiter): This populates an array with the strings created by splitting a string on the delimiter character.
  • substr(string, start-position, end-position): This returns the substring of the string between the start and end character offsets.
  • sub(regex, replacement_str, string): This replaces the first occurring regular expression match from the string with replacment_str.
  • gsub(regex, replacment_str, string): This is like sub(), but it replaces every regular expression ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985