Manipulating StringsBash supports a surprising number of string manipulation operations. Unfortunately, these tools lack a unified focus. Some are a subset of parameter substitution, and others fall under the functionality of the Unix expr command. This results in inconsistent command syntax and overlap of functionality, not to mention confusion. String Length
Example 9-10. Inserting a blank line between paragraphs in a text file
Length of Matching Substring at Beginning of String
Index
Substring Extraction
Substring Removal
Substring Replacement
9.2.1. Manipulating strings using awkA Bash script may invoke the string manipulation facilities of awk as an alternative to using its built-in operations. Example 9-12. Alternate ways of extracting substrings
|
Scripting > Linux shell >